Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| | |
| | | Register(typeof(HA3C1_tagMCDogzHelpbattleState), typeof(DTCA3C1_tagMCDogzHelpbattleState));
|
| | | #endregion
|
| | | Register(typeof(HA324_tagMCBindJadeWheelResult),typeof(DTCA324_tagMCBindJadeWheelResult));
|
| | |
|
| | | Register(typeof(HAA19_tagMCActWishingWellInfo), typeof(DTCAA19_tagMCActWishingWellInfo));
|
| | | Register(typeof(HAA1A_tagMCActWishingWellPlayerInfo), typeof(DTCAA1A_tagMCActWishingWellPlayerInfo));
|
| | | }
|
| | |
|
| | | private static void Register(Type _pack, Type _business)
|
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, June 20, 2018 |
| | | //-------------------------------------------------------- |
| | | |
| | | using UnityEngine; |
| | | using System; |
| | | |
| | | namespace TableConfig { |
| | | |
| | | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Monday, October 22, 2018
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using UnityEngine;
|
| | | using System;
|
| | |
|
| | | namespace TableConfig {
|
| | |
|
| | | |
| | | public partial class JobSetupConfig : ConfigBase {
|
| | |
|
| | | public int Job { get ; private set ; }
|
| | |
| | | public int MaxSwitchTargetDist { get ; private set ; }
|
| | | public int[] HangupSkillList;
|
| | | public string DungeonSkillList { get ; private set; }
|
| | | public string OffLineSkillList { get ; private set; } |
| | | public int HpPerUseSkill { get ; private set ; }
|
| | | public int[] HpSkillList;
|
| | | public int[] GainSkillList;
|
| | | public int MoveLimitDist { get ; private set ; }
|
| | | |
| | |
|
| | | public override string getKey()
|
| | | {
|
| | | return Job.ToString();
|
| | | } |
| | | |
| | | public override void Parse() { |
| | | }
|
| | |
|
| | | public override void Parse() {
|
| | | try
|
| | | {
|
| | | Job=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0;
|
| | |
| | |
|
| | | DungeonSkillList = rawContents[17].Trim();
|
| | |
|
| | | HpPerUseSkill=IsNumeric(rawContents[18]) ? int.Parse(rawContents[18]):0; |
| | | OffLineSkillList = rawContents[18].Trim();
|
| | |
|
| | | string[] HpSkillListStringArray = rawContents[19].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | HpPerUseSkill=IsNumeric(rawContents[19]) ? int.Parse(rawContents[19]):0; |
| | | |
| | | string[] HpSkillListStringArray = rawContents[20].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | HpSkillList = new int[HpSkillListStringArray.Length]; |
| | | for (int i=0;i<HpSkillListStringArray.Length;i++) |
| | | { |
| | | int.TryParse(HpSkillListStringArray[i],out HpSkillList[i]); |
| | | }
|
| | |
|
| | | string[] GainSkillListStringArray = rawContents[20].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | string[] GainSkillListStringArray = rawContents[21].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); |
| | | GainSkillList = new int[GainSkillListStringArray.Length]; |
| | | for (int i=0;i<GainSkillListStringArray.Length;i++) |
| | | { |
| | | int.TryParse(GainSkillListStringArray[i],out GainSkillList[i]); |
| | | }
|
| | |
|
| | | MoveLimitDist=IsNumeric(rawContents[21]) ? int.Parse(rawContents[21]):0; |
| | | MoveLimitDist=IsNumeric(rawContents[22]) ? int.Parse(rawContents[22]):0; |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | DebugEx.Log(ex);
|
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
| | | fileFormatVersion: 2 |
| | | guid: 027514b321a62b343897e7bda10272ee |
| | | timeCreated: 1529458253 |
| | | licenseType: Pro |
| | | timeCreated: 1540189086 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // AA 06 许愿池活动许愿 #tagCMActWishing
|
| | |
|
| | | public class CAA06_tagCMActWishing : GameNetPackBasic {
|
| | | public byte SrcWellType; // 来源库 0-可选库 1-结果库
|
| | | public byte SrcIndex; // 来源索引
|
| | | public byte DesWellType; // 目标库 0-可选库 1-结果库
|
| | | public byte DesIndex; // 目标索引
|
| | |
|
| | | public CAA06_tagCMActWishing () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xAA06;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (SrcWellType, NetDataType.BYTE);
|
| | | WriteBytes (SrcIndex, NetDataType.BYTE);
|
| | | WriteBytes (DesWellType, NetDataType.BYTE);
|
| | | WriteBytes (DesIndex, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a0799e6815403574f8e0804fc8f3489a |
| | | timeCreated: 1540173914 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // AA 07 许愿池活动刷新奖池 #tagCMActWishingRefresh
|
| | |
|
| | | public class CAA07_tagCMActWishingRefresh : GameNetPackBasic {
|
| | | public byte IsFree; // 是否免费刷新
|
| | |
|
| | | public CAA07_tagCMActWishingRefresh () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xAA07;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (IsFree, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: b503cda0c98dd19448d4dc0e2093d333 |
| | | timeCreated: 1540173914 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | if (ride) |
| | | { |
| | | MapConfig _map = Config.Instance.Get<MapConfig>(PlayerDatas.Instance.baseData.MapID); |
| | | if (_map == null || _map.CanRide == 0 || _map.MapFBType != 0) |
| | | if (_map == null || _map.CanRide == 0) |
| | | { |
| | | return; |
| | | } |
| | |
| | | |
| | | if (_mapConfig.MapFBType != 0) |
| | | { |
| | | DungeonModel _model = ModelCenter.Instance.GetModel<DungeonModel>();
|
| | | DungeonModel _model = ModelCenter.Instance.GetModel<DungeonModel>(); |
| | | _realMapDataID = _model.GetDataMapIdByMapId(_realMapDataID); |
| | | |
| | | if (package.MapID != 52020 && package.MapID != 52010)
|
| | | {
|
| | | if (package.MapID != 52020 && package.MapID != 52010) |
| | | { |
| | | DTCA127_tagMCStartChangeMap.LineID = package.FuncLineID; |
| | | } |
| | | }
|
| | |
|
| | | var _mapResConfig = DTCA127_tagMCStartChangeMap.GetMapResourcesConfig(_realMapDataID, DTCA127_tagMCStartChangeMap.LineID);
|
| | |
|
| | | if (_mapResConfig == null)
|
| | | {
|
| | | DTCA127_tagMCStartChangeMap.LineID = 0;
|
| | | _mapResConfig = DTCA127_tagMCStartChangeMap.GetMapResourcesConfig(_realMapDataID, DTCA127_tagMCStartChangeMap.LineID);
|
| | | } |
| | | |
| | | var _mapResConfig = DTCA127_tagMCStartChangeMap.GetMapResourcesConfig(_realMapDataID, DTCA127_tagMCStartChangeMap.LineID); |
| | | |
| | | if (_mapResConfig == null) |
| | | { |
| | | DTCA127_tagMCStartChangeMap.LineID = 0; |
| | | _mapResConfig = DTCA127_tagMCStartChangeMap.GetMapResourcesConfig(_realMapDataID, DTCA127_tagMCStartChangeMap.LineID); |
| | | } |
| | | |
| | | if (!WindowCenter.Instance.IsOpen<LoadingWin>()) |
| | |
| | | return; |
| | | } |
| | | |
| | | if(_mapConfig.CanRide == 0) |
| | | { |
| | | _hero.SwitchHorse(0); |
| | | DTC0428_tagPlayerRideHorse.Send_tagPlayerRideHorse(false); |
| | | } |
| | | _hero.ClearPathFindTarget(); |
| | | _hero.OnPathFindStop -= MapTransferUtility.Instance.OnHeroStopPathFind; |
| | | _hero.StopAll(); |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using Snxxz.UI;
|
| | | // AA 19 许愿池活动信息 #tagMCActWishingWellInfo
|
| | |
|
| | | public class DTCAA19_tagMCActWishingWellInfo : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HAA19_tagMCActWishingWellInfo vNetData = vNetPack as HAA19_tagMCActWishingWellInfo;
OperationTimeHepler.Instance.UpdateWishingWellInfo(vNetData);
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0f5809b019a6bd3458b831c341567252 |
| | | timeCreated: 1540173914 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using Snxxz.UI;
|
| | |
|
| | | // AA 1A 许愿池活动玩家信息 #tagMCActWishingWellPlayerInfo
|
| | |
|
| | |
|
| | |
|
| | | public class DTCAA1A_tagMCActWishingWellPlayerInfo : DtcBasic {
|
| | |
|
| | | WishingPoolModel wishModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HAA1A_tagMCActWishingWellPlayerInfo vNetData = vNetPack as HAA1A_tagMCActWishingWellPlayerInfo;
wishModel.SetWishingWellPlayerInfo(vNetData);
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f3b0342d3d2578d41a07f145e65fca6f |
| | | timeCreated: 1540173914 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // AA 19 许愿池活动信息 #tagMCActWishingWellInfo
|
| | |
|
| | | public class HAA19_tagMCActWishingWellInfo : GameNetPackBasic {
|
| | | public string StartDate; // 开始日期 y-m-d
|
| | | public string EndtDate; // 结束日期 y-m-d
|
| | | public byte IsDayReset; //是否每天重置
|
| | | public byte ResetType; // 重置类型,0-0点重置;1-5点重置
|
| | | public ushort LimitLV; // 限制等级
|
| | | public ushort Count; // 物品数
|
| | | public tagMCWishingWellItem[] WellItemInfo; // 随机库物品信息
|
| | |
|
| | | public HAA19_tagMCActWishingWellInfo () {
|
| | | _cmd = (ushort)0xAA19;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out StartDate, vBytes, NetDataType.Chars, 10);
|
| | | TransBytes (out EndtDate, vBytes, NetDataType.Chars, 10);
|
| | | TransBytes (out IsDayReset, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out ResetType, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out LimitLV, vBytes, NetDataType.WORD);
|
| | | TransBytes (out Count, vBytes, NetDataType.WORD);
|
| | | WellItemInfo = new tagMCWishingWellItem[Count];
|
| | | for (int i = 0; i < Count; i ++) {
|
| | | WellItemInfo[i] = new tagMCWishingWellItem();
|
| | | TransBytes (out WellItemInfo[i].ItemID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out WellItemInfo[i].ItemCnt, vBytes, NetDataType.WORD);
|
| | | TransBytes (out WellItemInfo[i].IsBind, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out WellItemInfo[i].Mark, vBytes, NetDataType.DWORD);
|
| | | }
|
| | | }
|
| | |
|
| | | public struct tagMCWishingWellItem {
|
| | | public uint ItemID; // 物品ID
|
| | | public ushort ItemCnt; // 物品数量
|
| | | public byte IsBind; // 是否绑定
|
| | | public uint Mark; // 排序标识
|
| | | }
|
| | |
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9e29f30207d395349a95715863102f47 |
| | | timeCreated: 1540173914 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // AA 1A 许愿池活动玩家信息 #tagMCActWishingWellPlayerInfo
|
| | |
|
| | |
|
| | |
|
| | | public class HAA1A_tagMCActWishingWellPlayerInfo : GameNetPackBasic {
|
| | |
|
| | | public uint FreeStartTime; // 免费开始倒计时时间
|
| | |
|
| | | public uint WishCnt; // 许愿付费刷新次数
|
| | |
|
| | | public byte WellItemCnt; //许愿池物品数量
|
| | |
|
| | | public tagMCPlayerWishingWellItem[] WellItemInfo; // 随机库物品信息
|
| | |
|
| | | public byte CurAwardCnt; // 当前奖励物品数量
|
| | |
|
| | | public tagMCPlayerWishingWellItem[] CurAwardItemInfo; // 当前奖励物品
|
| | |
|
| | | public byte LastAwardCnt; // 可领取奖励物品数量
|
| | |
|
| | | public tagMCPlayerWishingWellItem[] LastAwardItemInfo; // 可领取奖励物品
|
| | |
|
| | |
|
| | |
|
| | | public HAA1A_tagMCActWishingWellPlayerInfo () {
|
| | |
|
| | | _cmd = (ushort)0xAA1A;
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | |
|
| | | TransBytes (out FreeStartTime, vBytes, NetDataType.DWORD);
|
| | |
|
| | | TransBytes (out WishCnt, vBytes, NetDataType.DWORD);
|
| | |
|
| | | TransBytes (out WellItemCnt, vBytes, NetDataType.BYTE);
|
| | |
|
| | | WellItemInfo = new tagMCPlayerWishingWellItem[WellItemCnt];
|
| | |
|
| | | for (int i = 0; i < WellItemCnt; i ++) {
|
| | |
|
| | | WellItemInfo[i] = new tagMCPlayerWishingWellItem();
|
| | |
|
| | | TransBytes (out WellItemInfo[i].ItemID, vBytes, NetDataType.DWORD);
|
| | |
|
| | | TransBytes (out WellItemInfo[i].ItemCnt, vBytes, NetDataType.WORD);
|
| | |
|
| | | TransBytes (out WellItemInfo[i].IsBind, vBytes, NetDataType.BYTE);
|
| | |
|
| | | }
|
| | |
|
| | | TransBytes (out CurAwardCnt, vBytes, NetDataType.BYTE);
|
| | |
|
| | | CurAwardItemInfo = new tagMCPlayerWishingWellItem[CurAwardCnt];
|
| | |
|
| | | for (int i = 0; i < CurAwardCnt; i ++) {
|
| | |
|
| | | CurAwardItemInfo[i] = new tagMCPlayerWishingWellItem();
|
| | |
|
| | | TransBytes (out CurAwardItemInfo[i].ItemID, vBytes, NetDataType.DWORD);
|
| | |
|
| | | TransBytes (out CurAwardItemInfo[i].ItemCnt, vBytes, NetDataType.WORD);
|
| | |
|
| | | TransBytes (out CurAwardItemInfo[i].IsBind, vBytes, NetDataType.BYTE);
|
| | |
|
| | | }
|
| | |
|
| | | TransBytes (out LastAwardCnt, vBytes, NetDataType.BYTE);
|
| | |
|
| | | LastAwardItemInfo = new tagMCPlayerWishingWellItem[LastAwardCnt];
|
| | |
|
| | | for (int i = 0; i < LastAwardCnt; i ++) {
|
| | |
|
| | | LastAwardItemInfo[i] = new tagMCPlayerWishingWellItem();
|
| | |
|
| | | TransBytes (out LastAwardItemInfo[i].ItemID, vBytes, NetDataType.DWORD);
|
| | |
|
| | | TransBytes (out LastAwardItemInfo[i].ItemCnt, vBytes, NetDataType.WORD);
|
| | |
|
| | | TransBytes (out LastAwardItemInfo[i].IsBind, vBytes, NetDataType.BYTE);
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public struct tagMCPlayerWishingWellItem {
|
| | |
|
| | | public uint ItemID; // 物品ID
|
| | |
|
| | | public ushort ItemCnt; // 物品数量
|
| | |
|
| | | public byte IsBind; // 是否绑定
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | }
|
| | |
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6456db1385cb210498985c967a4a075b |
| | | timeCreated: 1540173914 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | |
|
| | | public static UnityAction<uint, bool> s_OnSelected;
|
| | | public static UnityAction<uint, ulong, ulong> s_OnRefreshLife;
|
| | |
|
| | | private static Dictionary<int, Dictionary<int, List<int>>> m_StaticOffLineSkllList = new Dictionary<int, Dictionary<int, List<int>>>();
|
| | | private int[] m_OffLineSkillList;
|
| | | protected H0434_tagAreaPlayerAppearEx m_H0434;
|
| | |
|
| | | private CmdManager m_CmdManager;
|
| | |
| | | RequestName();
|
| | |
|
| | | m_CmdManager = new CmdManager();
|
| | |
|
| | | if (m_H0434.State == 1)
|
| | | {
|
| | | if (!m_StaticOffLineSkllList.ContainsKey(m_H0434.Job))
|
| | | {
|
| | | m_StaticOffLineSkllList.Add(m_H0434.Job, new Dictionary<int, List<int>>());
|
| | |
|
| | | var _json = LitJson.JsonMapper.ToObject(JobSetup.OffLineSkillList);
|
| | | foreach (var _level in _json.Keys)
|
| | | {
|
| | | var _list = new List<int>();
|
| | | for (int i = 0; i < _json[_level].Count; ++i)
|
| | | {
|
| | | _list.Add((int)_json[_level][i]);
|
| | | }
|
| | | m_StaticOffLineSkllList[m_H0434.Job].Add(int.Parse(_level), _list);
|
| | | }
|
| | | }
|
| | |
|
| | | foreach (var _level in m_StaticOffLineSkllList[m_H0434.Job].Keys)
|
| | | {
|
| | | if (m_H0434.LV < _level)
|
| | | {
|
| | | m_OffLineSkillList = m_StaticOffLineSkllList[m_H0434.Job][_level].ToArray();
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | protected sealed override void OnUnit()
|
| | |
| | |
|
| | | m_CmdManager = null;
|
| | | m_H0434 = null;
|
| | | m_OffLineSkillList = null;
|
| | |
|
| | | base.OnUnit();
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | Skill _castSkill = null;
|
| | | int _skillIndex = UnityEngine.Random.Range(0, JobSetup.HangupSkillList.Length);
|
| | | if (SkillMgr.Get(JobSetup.HangupSkillList[_skillIndex]).IsValid())
|
| | |
|
| | | int _skillIndex = UnityEngine.Random.Range(0, m_OffLineSkillList.Length);
|
| | | if (SkillMgr.Get(m_OffLineSkillList[_skillIndex]).IsValid())
|
| | | {
|
| | | _castSkill = SkillMgr.Get(JobSetup.HangupSkillList[_skillIndex]);
|
| | | _castSkill = SkillMgr.Get(m_OffLineSkillList[_skillIndex]);
|
| | | }
|
| | |
|
| | | if (_castSkill == null)
|
| | |
| | | set
|
| | | {
|
| | | m_State = value;
|
| | | //if (ServerInstID == PlayerDatas.Instance.PlayerId)
|
| | | //{
|
| | | // Debug.Log("状态改变: " + State.ToString());
|
| | | //}
|
| | | // if (ServerInstID == PlayerDatas.Instance.PlayerId)
|
| | | // {
|
| | | // Debug.Log("状态改变: " + value.ToString());
|
| | | // }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | if (PathFindStatus == E_PathFindStatus.Moving
|
| | | && m_SearchType == E_SearchType.Static
|
| | | && DestPos == destPos)
|
| | | && MathUtility.DistanceSqrtXZ(DestPos, destPos) < 0.01f)
|
| | | {
|
| | | Run();
|
| | | return;
|
| | |
| | | {
|
| | | OnPathFindStop();
|
| | | }
|
| | |
|
| | | // if (ServerInstID == PlayerDatas.Instance.PlayerId)
|
| | | // {
|
| | | // Debug.Log("停止了移动");
|
| | | // }
|
| | | }
|
| | |
|
| | | private void MoveTo(Vector3 position, float keepDist = 0)
|
| | |
| | |
|
| | | if (NavMesh.CalculatePath(_curPos, position, NavMesh.AllAreas, m_Path))
|
| | | {
|
| | | //if (this is GA_Hero)
|
| | | //{
|
| | | // Debug.LogFormat("调用了 {0} 的寻路, 目标点: {1}", ServerInstID, position);
|
| | | //}
|
| | | // if (this is GA_Hero)
|
| | | // {
|
| | | // Debug.LogFormat("调用了 {0} 的寻路, 目标点: {1}", ServerInstID, position);
|
| | | // }
|
| | | m_CornerIndex = 0;
|
| | | m_KeepDist = keepDist;
|
| | | PathFindStatus = E_PathFindStatus.Moving;
|
| | |
| | | {
|
| | | _deltaDis = .5f;
|
| | | }
|
| | | Vector3 _prePos = Pos;
|
| | | Pos += _deltaDis * _dir;
|
| | | Vector3 _detalMove = _deltaDis * _dir;
|
| | | Pos += _detalMove;
|
| | | }
|
| | |
|
| | | if (OnPathFinding != null)
|
| | |
| | | public static void CheckPickupItem(Vector3 checkPosition)
|
| | | {
|
| | | // 挂机状态下
|
| | | if (SettingEffectMgr.Instance.GetSettingEffect())
|
| | | if (SettingEffectMgr.Instance.GetSettingEffect() && !UserInputHandler.isTouched)
|
| | | {
|
| | | // 不自动拾取则直接返回
|
| | | if (HangUpSetModel.Instance.GetBool(HangUpAutoBoolType.isAutoDrop) == false)
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | if (!CheckCanPickUp(m_MapItemDict[m_MapItemIdList[i]]))
|
| | | if (!CheckCanPickUp(m_MapItemDict[m_MapItemIdList[i]]) && !UserInputHandler.isTouched)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
| | | public event Action<float> loadingProgressEvent;
|
| | |
|
| | | bool m_IsServerPreparing = false;
|
| | | public bool isServerPreparing {
|
| | | public bool isServerPreparing
|
| | | {
|
| | | get { return m_IsServerPreparing; }
|
| | | set { m_IsServerPreparing = value; }
|
| | | }
|
| | |
|
| | | public Stage.E_StageType StageType {
|
| | | get {
|
| | | public Stage.E_StageType StageType
|
| | | {
|
| | | get
|
| | | {
|
| | | return m_StageType;
|
| | | }
|
| | | }
|
| | |
|
| | | public Stage CurrentStage {
|
| | | get {
|
| | | public Stage CurrentStage
|
| | | {
|
| | | get
|
| | | {
|
| | | return m_CurrentStage;
|
| | | }
|
| | | }
|
| | |
|
| | | int m_CurrentMapId;
|
| | | public int currentMapId {
|
| | | public int currentMapId
|
| | | {
|
| | | get { return m_CurrentMapId; }
|
| | | private set { m_CurrentMapId = value; }
|
| | | }
|
| | |
|
| | | int m_CurrentMapResID;
|
| | | public int currentMapResId {
|
| | | get {
|
| | | public int currentMapResId
|
| | | {
|
| | | get
|
| | | {
|
| | | return m_CurrentMapResID;
|
| | | }
|
| | | private set { m_CurrentMapResID = value; }
|
| | |
| | |
|
| | |
|
| | | float m_LoadingProgress = 0f;
|
| | | float loadingProgress {
|
| | | float loadingProgress
|
| | | {
|
| | | get { return m_LoadingProgress; }
|
| | | set {
|
| | | set
|
| | | {
|
| | | m_LoadingProgress = value;
|
| | | if (loadingProgressEvent != null)
|
| | | {
|
| | |
| | | _hero.SwitchWing((uint)_itemModel.itemInfo.ItemID);
|
| | | }
|
| | |
|
| | | _itemModel = _equipModel.GetItemModelByIndex((int)RoleEquipType.mount);
|
| | |
|
| | | if (_itemModel != null)
|
| | | var _mapConfig = Config.Instance.Get<MapConfig>(PlayerDatas.Instance.baseData.MapID);
|
| | | if (_mapConfig.CanRide == 1)
|
| | | {
|
| | | PlayerMountDatas _mountModel = ModelCenter.Instance.GetModel<PlayerMountDatas>();
|
| | | if (_mountModel.HorseRidingBool)
|
| | | _itemModel = _equipModel.GetItemModelByIndex((int)RoleEquipType.mount);
|
| | |
|
| | | if (_itemModel != null)
|
| | | {
|
| | | _hero.OnHorse(1);
|
| | | PlayerMountDatas _mountModel = ModelCenter.Instance.GetModel<PlayerMountDatas>();
|
| | | if (_mountModel.HorseRidingBool)
|
| | | {
|
| | | _hero.OnHorse(1);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | switch (type)
|
| | | {
|
| | | case ChatInfoType.World:
|
| | | case ChatInfoType.Fairy:
|
| | | if (IsAssitChat(msg) != 0)
|
| | | {
|
| | | teamModel.RequestAssistAutoMatch();
|
| | | }
|
| | | break;
|
| | | }
|
| | |
|
| | | switch (type)
|
| | | {
|
| | | case ChatInfoType.World:
|
| | | {
|
| | | C0201_tagCTalkGong chatPack = new C0201_tagCTalkGong();
|
| | | chatPack.Len = (ushort)GetUTF8InfoLen(msg);
|
| | | chatPack.Content = msg;
|
| | | GameNetSystem.Instance.SendInfo(chatPack);
|
| | |
|
| | | CheckSendAssitChat(msg);
|
| | | }
|
| | | break;
|
| | | case ChatInfoType.Area:
|
| | |
| | | chatPack.Len = (ushort)GetUTF8InfoLen(msg);
|
| | | chatPack.Content = msg;
|
| | | GameNetSystem.Instance.SendInfo(chatPack);
|
| | |
|
| | | CheckSendAssitChat(msg);
|
| | | }
|
| | | break;
|
| | | case ChatInfoType.Trumpet:
|
| | |
| | | public void RevChatInfo(H0201_tagTalkGong vNetData)
|
| | | {
|
| | | ChatData chatData = null;
|
| | | var content = vNetData.Content;
|
| | | if (IsInviteChat(vNetData.Content))
|
| | | {
|
| | | string content = InviteRegex.Replace(vNetData.Content, "");
|
| | | content = InviteRegex.Replace(vNetData.Content, "");
|
| | | if (teamModel.myTeam.GetIndexOfMember((int)vNetData.PlayerID) != -1)
|
| | | {
|
| | | content = StringUtility.Contact("<color=#f8983b>", vNetData.Name, "</color>", ":", content);
|
| | |
| | | KeepChatInfo(chatData);
|
| | | return;
|
| | | }
|
| | | chatData = new ChatWorldData(vNetData.Content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras);
|
| | | if (IsAssitChat(content, true) == 2 && vNetData.PlayerID != PlayerDatas.Instance.baseData.PlayerID)
|
| | | {
|
| | | content = StringUtility.Contact(content, Language.Get("InviteTeam", vNetData.PlayerID));
|
| | | }
|
| | | chatData = new ChatWorldData(content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras);
|
| | | KeepChatInfo(chatData);
|
| | | }
|
| | | /// <summary>
|
| | |
| | | /// <param name="vNetData"></param>
|
| | | public void RevChatInfo(H0203_tagTalkBang vNetData)
|
| | | {
|
| | | ChatData chatData = new ChatFamilyData(vNetData.Content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras);
|
| | | var content = vNetData.Content;
|
| | | if (IsAssitChat(content, true) == 1 && vNetData.PlayerID != PlayerDatas.Instance.baseData.PlayerID)
|
| | | {
|
| | | content = StringUtility.Contact(content, Language.Get("InviteTeam", vNetData.PlayerID));
|
| | | }
|
| | | ChatData chatData = new ChatFamilyData(content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras);
|
| | | KeepChatInfo(chatData);
|
| | | ReceiveNewChat(ChatInfoType.Fairy);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public bool needCheckAssitChat { get; set; }
|
| | | void CheckSendAssitChat(string message)
|
| | | int IsAssitChat(string message, bool force = false)
|
| | | {
|
| | | if (needCheckAssitChat)
|
| | | int assitChat = 0;
|
| | | if (needCheckAssitChat || force)
|
| | | {
|
| | | bool requestTeam = false;
|
| | | for (int i = 0; i < 2; i++)
|
| | | {
|
| | | if (message.Equals(Language.Get(realmRandomChats[i])))
|
| | | {
|
| | | requestTeam = true;
|
| | | assitChat = 1;
|
| | | break;
|
| | | }
|
| | |
|
| | | var content = message;
|
| | | if (i == 1)
|
| | | if (message.Equals(Language.Get(dungeonRandomChats[i])))
|
| | | {
|
| | | content = Regex.Replace(content, "[0-9]+", "{0}");
|
| | | }
|
| | |
|
| | | if (content.Equals(Language.Get(dungeonRandomChats[i])))
|
| | | {
|
| | | requestTeam = true;
|
| | | assitChat = 2;
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (requestTeam)
|
| | | {
|
| | | teamModel.RequestAssistAutoMatch();
|
| | | }
|
| | | }
|
| | | return assitChat;
|
| | | }
|
| | | #endregion
|
| | |
|
| New file |
| | |
| | | using System;
|
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using TableConfig;
|
| | | using UnityEngine; |
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class PutawayItem : MonoBehaviour
|
| | | {
|
| | | [SerializeField] Button m_Buy;
|
| | | [SerializeField] Text m_Price;
|
| | | [SerializeField] Image m_ItemBG;
|
| | | [SerializeField] Image m_ItemIcon;
|
| | | [SerializeField] Text m_ItemName;
|
| | | [SerializeField] Text m_ItemCount;
|
| | | [SerializeField] Transform[] m_Stars;
|
| | |
|
| | | public void Init(MarketItemData data, Action<MarketItemData> callback)
|
| | | {
|
| | | ItemConfig config = Config.Instance.Get<ItemConfig>((int)data.ItemTypeID);
|
| | | int uintprice = (int)data.PriceCount / data.Count;
|
| | | if (uintprice < 1)
|
| | | {
|
| | | m_Price.text = "<1";
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Price.text = data.PriceCount.ToString();
|
| | | }
|
| | | m_Buy.onClick.RemoveAllListeners();
|
| | | m_Buy.onClick.AddListener(() =>
|
| | | {
|
| | | if (callback != null)
|
| | | {
|
| | | callback(data);
|
| | | }
|
| | | });
|
| | | if (config != null)
|
| | | {
|
| | | m_ItemName.text = config.ItemName;
|
| | | var itemColor = config.ItemColor;
|
| | | if (config.Type == 111)//翅膀
|
| | | {
|
| | | itemColor = UIHelper.GetItemColor(config.ID, ConfigParse.Analysis(data.UserData));
|
| | | }
|
| | | m_ItemBG.SetItemBackGround(itemColor);
|
| | | bool _bright = (m_ItemName is RichText) ? (m_ItemName as RichText).colorType == RichText.ColorType.Bright : true;
|
| | | m_ItemName.color = UIHelper.GetUIColor(itemColor, _bright);
|
| | | m_ItemIcon.SetSprite(config.IconKey);
|
| | | for (int i = 0; i < m_Stars.Length; i++)
|
| | | {
|
| | | if (i < config.StarLevel)
|
| | | {
|
| | | m_Stars[i].gameObject.SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Stars[i].gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | | }
|
| | | if (data.Count == 1)
|
| | | {
|
| | | m_ItemCount.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ItemCount.gameObject.SetActive(true);
|
| | | m_ItemCount.text = data.Count.ToString();
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3e90d375cb6ec624ca467c0301e4cc56 |
| | | timeCreated: 1539935463 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | [SerializeField] Button reduceBtn; |
| | | [SerializeField] Text itemNum; |
| | | |
| | | [SerializeField] Transform queryItemTf; |
| | | [SerializeField] PutawayItem[] queryItems; |
| | | [SerializeField] GameObject noOtherTip; |
| | | |
| | | [SerializeField] Text putawayBtnText; |
| | |
| | | model.queryMarketItemList.TryGetValue(0, out list); |
| | | if (list != null) |
| | | { |
| | | int _Cnt = 0; |
| | | var index = 0; |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | MarketItemData data = list[i]; |
| | | if (data.PlayerID != PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | Transform child = queryItemTf.GetChild(_Cnt); |
| | | _Cnt++; |
| | | child.gameObject.SetActive(true); |
| | | ItemConfig cfg = Config.Instance.Get<ItemConfig>((int)data.ItemTypeID); |
| | | Text text = child.Find("PriceCnt").GetComponent<Text>(); |
| | | int uintprice = (int)data.PriceCount / data.Count; |
| | | if (uintprice < 1) text.text = "<1"; |
| | | else text.text = data.PriceCount.ToString(); |
| | | Button btn = child.GetComponent<Button>(); |
| | | btn.onClick.RemoveAllListeners(); |
| | | btn.onClick.AddListener(() => |
| | | { |
| | | OnQueryItemClick(data); |
| | | }); |
| | | if (cfg != null) |
| | | { |
| | | text = child.Find("ItemName").GetComponent<Text>(); |
| | | text.text = cfg.ItemName; |
| | | Image img = child.Find("Item/EquipBG").GetComponent<Image>(); |
| | | var _itemColor = cfg.ItemColor; |
| | | if (cfg.Type == 111)//翅膀 |
| | | { |
| | | _itemColor = UIHelper.GetItemColor(cfg.ID, ConfigParse.Analysis(data.UserData)); |
| | | } |
| | | img.SetItemBackGround(_itemColor); |
| | | bool _bright = (text is RichText) ? (text as RichText).colorType == RichText.ColorType.Bright : true; |
| | | text.color = UIHelper.GetUIColor(_itemColor, _bright); |
| | | img = child.Find("Item/ItemIcon").GetComponent<Image>(); |
| | | img.SetSprite(cfg.IconKey); |
| | | for (int j = 0; j < 3; j++) |
| | | { |
| | | GameObject obj = child.transform.Find(string.Format("Item/StarList/{0}", j)).gameObject; |
| | | if (j < cfg.StarLevel) |
| | | { |
| | | obj.SetActive(true); |
| | | } |
| | | else |
| | | { |
| | | obj.SetActive(false); |
| | | } |
| | | } |
| | | if (index < queryItems.Length)
|
| | | {
|
| | | queryItems[index].gameObject.SetActive(true);
|
| | | queryItems[index].Init(data, OnQueryItemClick);
|
| | | } |
| | | text = child.Find("Item/CountText").GetComponent<Text>(); |
| | | if (data.Count == 1) text.gameObject.SetActive(false); |
| | | else |
| | | { |
| | | text.gameObject.SetActive(true); |
| | | text.text = data.Count.ToString(); |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | for (int i = _Cnt; i < 3; i++) |
| | | for (int i = index; i < 3; i++) |
| | | { |
| | | queryItemTf.GetChild(i).gameObject.SetActive(false); |
| | | } |
| | | if (_Cnt > 0) |
| | | { |
| | | queryItemTf.gameObject.SetActive(true); |
| | | noOtherTip.SetActive(false); |
| | | } |
| | | queryItems[i].gameObject.SetActive(false); |
| | | }
|
| | | noOtherTip.SetActive(index == 0); |
| | | } |
| | | } |
| | | #region 购买物品 |
| | |
| | | |
| | | private void InitData() |
| | | { |
| | | queryItemTf.gameObject.SetActive(false); |
| | | for (int i = 0; i < queryItems.Length; i++)
|
| | | {
|
| | | queryItems[i].gameObject.SetActive(false);
|
| | | } |
| | | noOtherTip.SetActive(true); |
| | | if (PutawayData.Instance.itemModel == null) |
| | | { |
| | |
| | | presentHrefInfo.Add(split_value, array[1]);
|
| | | }
|
| | | break;
|
| | | case "jointeam":
|
| | | {
|
| | | presentHrefInfo.mEvents.Add(RichTextEventEnum.JOINTEAM);
|
| | | presentHrefInfo.Add(split_value, array[1]);
|
| | | }
|
| | | break;
|
| | | case "openui":
|
| | | {
|
| | | presentHrefInfo.mEvents.Add(RichTextEventEnum.OPENUI);
|
| | |
| | | SHOWPLAYER,//玩家详情
|
| | | TIP,//信息提示
|
| | | GetWay,//获取途径
|
| | | JOINTEAM,//加入队伍
|
| | | }
|
| | |
| | | RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.OPENUI, this);
|
| | | RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.TIP, this);
|
| | | RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.GetWay, this);
|
| | | RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.JOINTEAM, this);
|
| | | }
|
| | |
|
| | | public override bool Execute(RichTextEventEnum type, RichTextMgr.HrefInfo href)
|
| | |
| | | }
|
| | | }
|
| | | break;
|
| | | case RichTextEventEnum.JOINTEAM:
|
| | | {
|
| | | uint id = 0;
|
| | | if (uint.TryParse(href.mSplits["jointeam"], out id))
|
| | | {
|
| | | var teamModel = ModelCenter.Instance.GetModel<TeamModel>();
|
| | | if (teamModel.myTeam.GetIndexOfMember((int)id) != -1)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("AlreadyInTeam2");
|
| | | return false;
|
| | | }
|
| | | teamModel.RequestInviteJoinTeam((int)id);
|
| | | }
|
| | | }
|
| | | break;
|
| | | case RichTextEventEnum.INVITE:
|
| | | {
|
| | | uint id = 0;
|
| | |
| | | FairyGrabBossNotice,
|
| | | [Header("限时抢购")]
|
| | | FlashRushToBuy,
|
| | | [Header("许愿池")]
|
| | | WishingPool,
|
| | | }
|
| | | }
|
| | |
|
| New file |
| | |
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class OperationWishingWellInfo : OperationBase
|
| | | {
|
| | | public Dictionary<int, List<WishingWellItem>> wellItemDict = new Dictionary<int, List<WishingWellItem>>(); //key 组
|
| | |
|
| | | public override void Reset()
|
| | | {
|
| | | base.Reset();
|
| | | wellItemDict.Clear();
|
| | | }
|
| | |
|
| | | public override string ToDisplayTime()
|
| | | {
|
| | | var textBuilder = OperationTimeHepler.textBuilder;
|
| | | textBuilder.Length = 0;
|
| | | textBuilder.Append(startDate.ToDisplay());
|
| | | if (startDate != endDate)
|
| | | {
|
| | | textBuilder.Append("—");
|
| | | textBuilder.Append(endDate.ToDisplay());
|
| | | }
|
| | | return textBuilder.ToString();
|
| | | }
|
| | |
|
| | | public List<WishingWellItem> GetWellItemsByGroupType(int groupType)
|
| | | {
|
| | | List<WishingWellItem> items = null;
|
| | | wellItemDict.TryGetValue(groupType,out items);
|
| | | return items;
|
| | | }
|
| | |
|
| | | public int GetActivityDay()
|
| | | {
|
| | | int dayIndex = IndexOfDays(TimeUtility.ServerNow);
|
| | | return dayIndex + 1;
|
| | | }
|
| | |
|
| | | public void ParsePackage(HAA19_tagMCActWishingWellInfo package)
|
| | | {
|
| | | for (int i = 0; i < package.Count; i++)
|
| | | {
|
| | | var itemInfo = package.WellItemInfo[i];
|
| | | var wellItem = new WishingWellItem((int)itemInfo.ItemID,itemInfo.ItemCnt,itemInfo.IsBind,(int)itemInfo.Mark);
|
| | | int group = GetGroupTypeByMark(wellItem.mark);
|
| | | if(!wellItemDict.ContainsKey(group))
|
| | | {
|
| | | List<WishingWellItem> list = new List<WishingWellItem>();
|
| | | list.Add(wellItem);
|
| | | wellItemDict.Add(group,list);
|
| | | }
|
| | | else
|
| | | {
|
| | | wellItemDict[group].Add(wellItem);
|
| | | }
|
| | | }
|
| | |
|
| | | foreach(var key in wellItemDict.Keys)
|
| | | {
|
| | | wellItemDict[key].Sort(CompareByMark);
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetGroupTypeByMark(int mark)
|
| | | {
|
| | | return mark / 100;
|
| | | }
|
| | |
|
| | | public int GetGroupIndexByMark(int mark)
|
| | | {
|
| | | return mark % 100;
|
| | | }
|
| | |
|
| | | public int CompareByMark(WishingWellItem start,WishingWellItem end)
|
| | | {
|
| | | if(start.mark.CompareTo(end.mark) != 0)
|
| | | {
|
| | | return -start.mark.CompareTo(end.mark);
|
| | | }
|
| | | return 0;
|
| | | }
|
| | | |
| | | public class WishingWellItem
|
| | | {
|
| | | public int itemId;
|
| | | public int itemCount;
|
| | | public int isBind;
|
| | | public int mark;// 排序标识
|
| | | public WishingWellItem(int id, int count, int isBind,int mark)
|
| | | {
|
| | | this.itemId = id;
|
| | | this.itemCount = count;
|
| | | this.isBind = isBind;
|
| | | this.mark = mark;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 63866afdba3f2ad47a206dc17e8da80f |
| | | timeCreated: 1540178667 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class PoolItemCell : MonoBehaviour,IDragHandler,IDropHandler |
| | | public class PoolItemCell : MonoBehaviour,IDragHandler
|
| | | {
|
| | | [SerializeField] CommonItemBaisc itemBaisc;
|
| | | [SerializeField] GameObject bestIconObj;
|
| | |
|
| | | ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
| | | WishingPoolModel wishingModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
|
| | | int itemId = 0;
|
| | | int index = -1;
|
| | |
|
| | | public void OnDrag(PointerEventData eventData)
|
| | | {
|
| | | Debug.Log("拖拽开始");
|
| | | wishingModel.isDraging = true;
|
| | | wishingModel.dragItemId = itemId;
|
| | | wishingModel.dragIndex = index;
|
| | | }
|
| | |
|
| | | public void OnDrop(PointerEventData eventData)
|
| | | |
| | | public void Display(int index)
|
| | | {
|
| | | Debug.Log("拖拽结束");
|
| | | wishingModel.ResetDragData();
|
| | | }
|
| | |
|
| | | public void Display(int itemId)
|
| | | {
|
| | | this.itemId = itemId;
|
| | | this.index = index;
|
| | | WishingPoolModel.WishingWellItem wellItem = null;
|
| | | bool isPoolData = wishingModel.TryGetPoolDataByIndex(index,out wellItem);
|
| | | bestIconObj.SetActive(false);
|
| | | ItemCellModel cellModel = new ItemCellModel(itemId);
|
| | | ItemCellModel cellModel = new ItemCellModel(wellItem.itemId,false,(ulong)wellItem.itemCount,wellItem.isBind);
|
| | | itemBaisc.Init(cellModel);
|
| | | itemBaisc.cellBtn.RemoveAllListeners();
|
| | | itemBaisc.cellBtn.AddListener(()=>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(itemId);
|
| | | ItemAttrData attrData = new ItemAttrData(wellItem.itemId, true, (ulong)wellItem.itemCount, -1,wellItem.isBind);
|
| | | tipsModel.SetItemTipsModel(attrData);
|
| | | });
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| New file |
| | |
| | | using EnhancedUI.EnhancedScroller;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class WishGroupCell : ScrollerUI
|
| | | {
|
| | | [SerializeField] List<PoolItem> poolItems = new List<PoolItem>();
|
| | | WishingPoolModel wishModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
|
| | | ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
| | |
|
| | | public override void Refresh(CellView cell)
|
| | | {
|
| | | var operation = wishModel.GetOperationWishing();
|
| | | if (operation == null) return;
|
| | | var items = operation.GetWellItemsByGroupType(cell.index);
|
| | | if (items == null) return;
|
| | |
|
| | | for(int i = 0; i < poolItems.Count; i++)
|
| | | {
|
| | | var poolItem = poolItems[i];
|
| | | if(i < items.Count)
|
| | | {
|
| | | poolItem.Object.SetActive(true);
|
| | | var info = items[i];
|
| | | ItemCellModel cellModel = new ItemCellModel(info.itemId,true,(ulong)info.itemCount,info.isBind);
|
| | | poolItem.itemBaisc.Init(cellModel);
|
| | | if(i == 0)
|
| | | {
|
| | | poolItem.bestImg.SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | poolItem.bestImg.SetActive(false);
|
| | | }
|
| | |
|
| | | poolItem.itemBaisc.cellBtn.RemoveAllListeners();
|
| | | poolItem.itemBaisc.cellBtn.AddListener(()=>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(info.itemId,true, (ulong)info.itemCount,-1,info.isBind);
|
| | | tipsModel.SetItemTipsModel(attrData);
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | poolItem.Object.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | [Serializable]
|
| | | public class PoolItem
|
| | | {
|
| | | public GameObject Object;
|
| | | public CommonItemBaisc itemBaisc;
|
| | | public GameObject bestImg;
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 788a58cd965d16646b5452012b08d27b |
| | | timeCreated: 1540193610 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | using System.Collections.Generic;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class WishingPoolModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk
|
| | | public class WishingPoolModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk,IOpenServerActivity
|
| | | {
|
| | | public event Action<int> UpdateWishingDataEvent;
|
| | | public event Action<int> UpdatePoolDataEvent;
|
| | | public event Action<int> onStateUpate;
|
| | | public const int WishRedKey = 20915;
|
| | | public override void Init()
|
| | | {
|
| | | |
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
|
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
|
| | | OperationTimeHepler.Instance.operationAdvanceEvent += OperationAdvanceEvent;
|
| | | OpenServerActivityCenter.Instance.Register((int)OpenServerActivityCenter.OSActivityType.FlashRushToBuy, this);
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | SetWishingPoolData();
|
| | | UpdateRedpoint();
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | |
| | |
|
| | | }
|
| | |
|
| | | public bool IsOpen
|
| | | {
|
| | | get
|
| | | {
|
| | | return OperationTimeHepler.Instance.SatisfyOpenCondition(Operation.WishingWellInfo);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool priorityOpen
|
| | | {
|
| | | get
|
| | | {
|
| | | return wishPoolRedpoint.state == RedPointState.Simple;
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsAdvance
|
| | | {
|
| | | get
|
| | | {
|
| | | return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.WishingWellInfo);
|
| | | }
|
| | | }
|
| | |
|
| | | private void OperationEndEvent(Operation type, int state)
|
| | | {
|
| | | if (type == Operation.WishingWellInfo && state == 1)
|
| | | {
|
| | | UpdateRedpoint();
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate((int)OpenServerActivityCenter.OSActivityType.WishingPool);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OperationAdvanceEvent(Operation type)
|
| | | {
|
| | | if (type == Operation.WishingWellInfo)
|
| | | {
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate((int)OpenServerActivityCenter.OSActivityType.WishingPool);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OperationStartEvent(Operation type, int state)
|
| | | {
|
| | | if (type == Operation.WishingWellInfo && state == 1)
|
| | | {
|
| | | UpdateRedpoint();
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate((int)OpenServerActivityCenter.OSActivityType.WishingPool);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public OperationWishingWellInfo GetOperationWishing()
|
| | | {
|
| | | OperationBase operationBase;
|
| | | if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.WishingWellInfo, out operationBase))
|
| | | {
|
| | | return operationBase as OperationWishingWellInfo;
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | public bool TryGetFreeWishCoolTime(out int second)
|
| | | {
|
| | | second = 0;
|
| | | if (freeStartTime == 25) return false;
|
| | |
|
| | | int endhour = freeStartTime + 2;
|
| | | int nowHour = TimeUtility.ServerNow.Hour;
|
| | | second = (endhour - nowHour) * 3600;
|
| | | if(second > 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | #region 本地数据
|
| | | public bool isDraging { get; set; }
|
| | | public int dragItemId { get; set; }
|
| | | public int dragIndex { get; set; }
|
| | | public void ResetDragData()
|
| | | {
|
| | | isDraging = false;
|
| | | dragItemId = 0;
|
| | | dragIndex = -1;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 协议
|
| | | Dictionary<int, int> poolDataDict = new Dictionary<int, int>();
|
| | | public void SetWishingPoolData()
|
| | | Dictionary<int, WishingWellItem> poolDataDict = new Dictionary<int, WishingWellItem>();
|
| | | public int freeStartTime { get; private set; }// 免费开始倒计时时间
|
| | | public int alreadyWishNum { get; private set; } // 许愿付费刷新次数
|
| | |
|
| | | public void SetWishingWellPlayerInfo(HAA1A_tagMCActWishingWellPlayerInfo wishInfo)
|
| | | {
|
| | | for(int i = 0; i< 8; i++)
|
| | | freeStartTime = (int)wishInfo.FreeStartTime;
|
| | | alreadyWishNum = (int)wishInfo.WishCnt;
|
| | | for(int i = 0; i < wishInfo.WellItemCnt; i++)
|
| | | {
|
| | | int itemId = 10101 + i;
|
| | | poolDataDict.Add(i,itemId);
|
| | | var itemInfo = wishInfo.WellItemInfo[i];
|
| | | WishingWellItem wellItem = new WishingWellItem((int)itemInfo.ItemID,itemInfo.ItemCnt,itemInfo.IsBind);
|
| | | SetWishingPoolData(i,wellItem);
|
| | | }
|
| | |
|
| | | for(int i = 0; i < wishInfo.CurAwardCnt; i++)
|
| | | {
|
| | | var itemInfo = wishInfo.CurAwardItemInfo[i];
|
| | | WishingWellItem wellItem = new WishingWellItem((int)itemInfo.ItemID, itemInfo.ItemCnt, itemInfo.IsBind);
|
| | | SetWishingData(i, wellItem);
|
| | | }
|
| | |
|
| | | wishingAwardDict.Clear();
|
| | | for (int i = 0; i < wishInfo.LastAwardCnt; i++)
|
| | | {
|
| | | var itemInfo = wishInfo.LastAwardItemInfo[i];
|
| | | WishingWellItem wellItem = new WishingWellItem((int)itemInfo.ItemID, itemInfo.ItemCnt, itemInfo.IsBind);
|
| | | SetWishingAwardData(i, wellItem);
|
| | | }
|
| | | UpdateRedpoint();
|
| | | }
|
| | |
|
| | | Dictionary<int, int> wishingDataDict = new Dictionary<int, int>();
|
| | | public void SetWishingData(int index,int id)
|
| | | public void SetWishingPoolData(int index, WishingWellItem wellItem)
|
| | | {
|
| | | if(!wishingDataDict.ContainsKey(index))
|
| | | if (!poolDataDict.ContainsKey(index))
|
| | | {
|
| | | wishingDataDict.Add(index,id);
|
| | | poolDataDict.Add(index,wellItem);
|
| | | }
|
| | | else
|
| | | {
|
| | | wishingDataDict[index] = id;
|
| | | poolDataDict[index] = wellItem;
|
| | | }
|
| | | if(UpdatePoolDataEvent != null)
|
| | | {
|
| | | UpdatePoolDataEvent(index);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool TryGetPoolDataByIndex(int index,out int id)
|
| | | public void RemovetWishingPoolData(int index)
|
| | | {
|
| | | return poolDataDict.TryGetValue(index,out id);
|
| | | if (poolDataDict.ContainsKey(index))
|
| | | {
|
| | | poolDataDict.Remove(index);
|
| | | }
|
| | | if (UpdatePoolDataEvent != null)
|
| | | {
|
| | | UpdatePoolDataEvent(index);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool TryGetWishDataByIndex(int index, out int id)
|
| | | Dictionary<int, WishingWellItem> wishingDataDict = new Dictionary<int, WishingWellItem>();
|
| | | public void SetWishingData(int index, WishingWellItem wellItem)
|
| | | {
|
| | | return wishingDataDict.TryGetValue(index, out id);
|
| | | if(!wishingDataDict.ContainsKey(index))
|
| | | {
|
| | | wishingDataDict.Add(index,wellItem);
|
| | | }
|
| | | else
|
| | | {
|
| | | wishingDataDict[index] = wellItem;
|
| | | }
|
| | |
|
| | | if(UpdateWishingDataEvent != null)
|
| | | {
|
| | | UpdateWishingDataEvent(index);
|
| | | }
|
| | | }
|
| | |
|
| | | Dictionary<int, WishingWellItem> wishingAwardDict = new Dictionary<int, WishingWellItem>();
|
| | | public void SetWishingAwardData(int index, WishingWellItem wellItem)
|
| | | {
|
| | | if (!wishingAwardDict.ContainsKey(index))
|
| | | {
|
| | | wishingAwardDict.Add(index, wellItem);
|
| | | }
|
| | | else
|
| | | {
|
| | | wishingAwardDict[index] = wellItem;
|
| | | }
|
| | | }
|
| | | |
| | | public bool IsBetterItem()
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool TryGetPoolDataByIndex(int index,out WishingWellItem wellItem)
|
| | | {
|
| | | if(poolDataDict.TryGetValue(index, out wellItem))
|
| | | {
|
| | | if(wellItem.itemId != 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool TryGetWishDataByIndex(int index, out WishingWellItem wellItem)
|
| | | {
|
| | | if(wishingDataDict.TryGetValue(index, out wellItem))
|
| | | {
|
| | | if(wellItem.itemId != 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public void SendRefreshPoolInfo(int refreshType)
|
| | | {
|
| | | CAA07_tagCMActWishingRefresh wishingRefresh = new CAA07_tagCMActWishingRefresh();
|
| | | wishingRefresh.IsFree = (byte)refreshType;
|
| | | GameNetSystem.Instance.SendInfo(wishingRefresh);
|
| | | }
|
| | |
|
| | | public void SendRefreshWishInfo(int poolIndex,int wishIndex)
|
| | | {
|
| | | CAA06_tagCMActWishing actWishing = new CAA06_tagCMActWishing();
|
| | | actWishing.SrcWellType = 0;
|
| | | actWishing.SrcIndex = (byte)poolIndex;
|
| | | actWishing.DesWellType = 1;
|
| | | actWishing.DesIndex = (byte)wishIndex;
|
| | | GameNetSystem.Instance.SendInfo(actWishing);
|
| | |
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 红点
|
| | | public Redpoint wishPoolRedpoint = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, WishRedKey);
|
| | | public const int FREEWISH_REDKEY = 2091501;
|
| | | public Redpoint freeWishRedpoint = new Redpoint(WishRedKey, FREEWISH_REDKEY);
|
| | | public List<Redpoint> wishPointlist = new List<Redpoint>();
|
| | | public void SetWishRedpoint()
|
| | | {
|
| | | wishPointlist.Clear();
|
| | | for (int i = 0; i < 5; i++)
|
| | | {
|
| | | int redKey = WishRedKey * 100 + (i + 2);
|
| | | Redpoint redpoint = new Redpoint(WishRedKey,redKey);
|
| | | wishPointlist.Add(redpoint);
|
| | | }
|
| | | }
|
| | | private void UpdateRedpoint()
|
| | | {
|
| | | int second = 0;
|
| | | bool isCool = TryGetFreeWishCoolTime(out second);
|
| | | if(IsOpen && !isCool)
|
| | | {
|
| | | freeWishRedpoint.state = RedPointState.Simple;
|
| | | }
|
| | | else
|
| | | {
|
| | | freeWishRedpoint.state = RedPointState.None;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < wishPointlist.Count; i++)
|
| | | {
|
| | | var wishPoint = wishPointlist[i];
|
| | | wishPoint.state = RedPointState.None;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < wishPointlist.Count; i++)
|
| | | {
|
| | | var wishPoint = wishPointlist[i];
|
| | | WishingWellItem wellItem = null;
|
| | | bool isWishData = TryGetWishDataByIndex(i,out wellItem);
|
| | | if(!isWishData)
|
| | | {
|
| | | wishPoint.state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | public void ResetPoolData()
|
| | | {
|
| | | freeStartTime = 25;
|
| | | poolDataDict.Clear();
|
| | | wishingDataDict.Clear();
|
| | | wishingAwardDict.Clear();
|
| | | }
|
| | |
|
| | | public class WishingWellItem
|
| | | {
|
| | | public int itemId;
|
| | | public int itemCount;
|
| | | public int isBind;
|
| | | public WishingWellItem(int id,int count,int isBind)
|
| | | {
|
| | | this.itemId = id;
|
| | | this.itemCount = count;
|
| | | this.isBind = isBind;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | public class WishingPoolWin : Window
|
| | | {
|
| | | [SerializeField] DragItem dragItem;
|
| | | [SerializeField] Text activityDayText;
|
| | | [SerializeField] Text totalDayText;
|
| | | [SerializeField] Button lookAllBtn;
|
| | | [SerializeField] Button refreshWishBtn;
|
| | | [SerializeField] Text freeWishCoolText;
|
| | | [SerializeField] List<PoolItemCell> poolItemCells = new List<PoolItemCell>();
|
| | | [SerializeField] List<WishingCell> wishingCells = new List<WishingCell>();
|
| | | [SerializeField] GameObject activityOpenObj;
|
| | | [SerializeField] GameObject activityCloseObj;
|
| | |
|
| | | ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
| | | WishingPoolModel wishingModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
|
| | | OperationWishingWellInfo operation = null;
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | | {
|
| | |
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | |
| | | refreshWishBtn.AddListener(ClickRefreshWish);
|
| | | lookAllBtn.AddListener(ClickLook);
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | |
|
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
|
| | | wishingModel.UpdatePoolDataEvent += UpdatePoolItemByIndex;
|
| | | wishingModel.UpdateWishingDataEvent += UpdateWishItemByIndex;
|
| | | GlobalTimeEvent.Instance.hourEvent += UpdateFreeWishCool;
|
| | | Display();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | | }
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | |
| | | wishingModel.UpdatePoolDataEvent -= UpdatePoolItemByIndex;
|
| | | wishingModel.UpdateWishingDataEvent -= UpdateWishItemByIndex;
|
| | | GlobalTimeEvent.Instance.hourEvent -= UpdateFreeWishCool;
|
| | | OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | |
| | |
|
| | | private void Display()
|
| | | {
|
| | | operation = wishingModel.GetOperationWishing();
|
| | | if (operation == null) return;
|
| | |
|
| | | UpdatePoolItem();
|
| | | for(int i = 0; i < wishingCells.Count; i++)
|
| | | {
|
| | | UpdateWishItemByIndex(i);
|
| | | }
|
| | | dragItem.dragItemRect.gameObject.SetActive(false);
|
| | | UpdateFreeWishCool();
|
| | | UpdateActivityState();
|
| | | activityDayText.text = Language.Get("SignIn_4", Language.Get(StringUtility.Contact("Num_CHS_", operation.GetActivityDay())));
|
| | | totalDayText.text = StringUtility.Contact("活动持续", Language.Get(StringUtility.Contact("Num_CHS_",operation.totalDays + 1)), "天");
|
| | | }
|
| | |
|
| | |
|
| | | #region 许愿逻辑
|
| | | protected override void LateUpdate()
|
| | | {
|
| | | if(wishingModel.isDraging)
|
| | | {
|
| | | if(TryGetDragItem())
|
| | | {
|
| | | Vector2 _pos;
|
| | | if (RectTransformUtility.ScreenPointToLocalPointInRectangle(this.transform as RectTransform,
|
| | | Input.mousePosition, CameraManager.uiCamera, out _pos))
|
| | | {
|
| | | dragItem.dragItemRect.anchoredPosition3D = _pos;
|
| | | }
|
| | |
|
| | | if (Input.GetMouseButtonUp(0))
|
| | | {
|
| | | dragItem.dragItemRect.gameObject.SetActive(false);
|
| | | CheckWishingCell();
|
| | | wishingModel.ResetDragData();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | private void CheckWishingCell()
|
| | | {
|
| | | for(int i = 0; i < wishingCells.Count; i++)
|
| | | {
|
| | | var rect = wishingCells[i].wishRect;
|
| | | var des = RectTransformUtility.CalculateRelativeRectTransformBounds(this.transform, rect);
|
| | | var src = RectTransformUtility.CalculateRelativeRectTransformBounds(this.transform, dragItem.dragItemRect);
|
| | | var dis = Vector3.Distance(des.center, src.center);
|
| | | if (dis < rect.rect.width / 2)
|
| | | {
|
| | | //WishingPoolModel.WishingWellItem wellPoolItem = null;
|
| | | //bool isPoolData = wishingModel.TryGetPoolDataByIndex(wishingModel.dragIndex, out wellPoolItem);
|
| | | //WishingPoolModel.WishingWellItem wellWishItem = null;
|
| | | //bool isWishData = wishingModel.TryGetWishDataByIndex(i, out wellWishItem);
|
| | | //if (wellWishItem.itemId == 0)
|
| | | //{
|
| | | // wishingModel.RemovetWishingPoolData(i);
|
| | | //}
|
| | | //else
|
| | | //{
|
| | | // wishingModel.SetWishingPoolData(wishingModel.dragIndex,wellWishItem);
|
| | | //}
|
| | | //wishingModel.SetWishingData(i,wellPoolItem);
|
| | | wishingModel.SendRefreshWishInfo(wishingModel.dragIndex,i);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private bool TryGetDragItem()
|
| | | {
|
| | | WishingPoolModel.WishingWellItem wellItem = null;
|
| | | bool isPoolData = wishingModel.TryGetPoolDataByIndex(wishingModel.dragIndex, out wellItem);
|
| | | if (isPoolData)
|
| | | {
|
| | | dragItem.dragItemRect.gameObject.SetActive(true);
|
| | | dragItem.dragBestIcon.SetActive(false);
|
| | | ItemCellModel cellModel = new ItemCellModel(wellItem.itemId,false,(ulong)wellItem.itemCount,wellItem.isBind);
|
| | | dragItem.dragItemBasic.Init(cellModel);
|
| | | }
|
| | | else
|
| | | {
|
| | | dragItem.dragItemRect.gameObject.SetActive(false);
|
| | | }
|
| | | return isPoolData;
|
| | | }
|
| | |
|
| | | private void UpdatePoolItem()
|
| | |
| | |
|
| | | private void UpdatePoolItemByIndex(int index)
|
| | | {
|
| | | int id = 0;
|
| | | WishingPoolModel.WishingWellItem wellItem = null;
|
| | | var poolItemCell = poolItemCells[index];
|
| | | bool isPoolData = wishingModel.TryGetPoolDataByIndex(index, out id);
|
| | | bool isPoolData = wishingModel.TryGetPoolDataByIndex(index, out wellItem);
|
| | | if (isPoolData)
|
| | | {
|
| | | poolItemCell.gameObject.SetActive(true);
|
| | | poolItemCell.Display(id);
|
| | | poolItemCell.Display(index);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | |
|
| | | private void UpdateWishItemByIndex(int index)
|
| | | {
|
| | | int id = 0;
|
| | | WishingPoolModel.WishingWellItem wellItem = null;
|
| | | var wishCell = wishingCells[index];
|
| | | bool isWishData = wishingModel.TryGetWishDataByIndex(index, out id);
|
| | | bool isWishData = wishingModel.TryGetWishDataByIndex(index, out wellItem);
|
| | | if (isWishData)
|
| | | {
|
| | | wishCell.itemBaisc.gameObject.SetActive(true);
|
| | | wishCell.noneItemObj.gameObject.SetActive(false);
|
| | | ItemCellModel cellModel = new ItemCellModel(id);
|
| | | ItemCellModel cellModel = new ItemCellModel(wellItem.itemId, false, (ulong)wellItem.itemCount, wellItem.isBind);
|
| | | wishCell.itemBaisc.Init(cellModel);
|
| | | wishCell.itemBaisc.cellBtn.RemoveAllListeners();
|
| | | wishCell.itemBaisc.cellBtn.AddListener(() =>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(id);
|
| | | ItemAttrData attrData = new ItemAttrData(wellItem.itemId, true, (ulong)wellItem.itemCount,-1,wellItem.isBind);
|
| | | tipsModel.SetItemTipsModel(attrData);
|
| | | });
|
| | | }
|
| | |
| | | [Serializable]
|
| | | public class WishingCell
|
| | | {
|
| | | public RectTransform wishRect;
|
| | | public CommonItemBaisc itemBaisc;
|
| | | public GameObject noneItemObj;
|
| | | public Button noneItemBtn;
|
| | |
| | | [Serializable]
|
| | | public class DragItem
|
| | | {
|
| | | [SerializeField] CommonItemBaisc dragItemBasic;
|
| | | [SerializeField] GameObject dragBestIcon;
|
| | | public RectTransform dragItemRect;
|
| | | public CommonItemBaisc dragItemBasic;
|
| | | public GameObject dragBestIcon;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 活动逻辑
|
| | | private void OperationEndEvent(Operation type, int state)
|
| | | {
|
| | | if(type == Operation.WishingWellInfo && state == 1)
|
| | | {
|
| | | UpdateActivityState();
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateFreeWishCool()
|
| | | {
|
| | | int second = 0;
|
| | | bool isCool = wishingModel.TryGetFreeWishCoolTime(out second);
|
| | | if (isCool)
|
| | | {
|
| | | freeWishCoolText.gameObject.SetActive(true);
|
| | | freeWishCoolText.text = TimeUtility.SecondsToHMS(second);
|
| | | }
|
| | | else
|
| | | {
|
| | | freeWishCoolText.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateActivityState()
|
| | | {
|
| | | if (wishingModel.IsOpen)
|
| | | {
|
| | | activityOpenObj.SetActive(true);
|
| | | activityCloseObj.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | activityOpenObj.SetActive(false);
|
| | | activityCloseObj.SetActive(true);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void ClickLook()
|
| | | {
|
| | | WindowCenter.Instance.Open<WishingWarehouseWin>();
|
| | | }
|
| | |
|
| | | private void ClickRefreshWish()
|
| | | {
|
| | | int second = 0;
|
| | | bool isCool = wishingModel.TryGetFreeWishCoolTime(out second);
|
| | | if(isCool)
|
| | | {
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | |
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | }
|
| | | }
|
| New file |
| | |
| | | using System;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class WishingWarehouseWin : Window
|
| | | {
|
| | | [SerializeField] ScrollerController wishGroupCtrl;
|
| | | WishingPoolModel wishModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
|
| | | protected override void BindController()
|
| | | {
|
| | | |
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | CreateWishGroup();
|
| | | }
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | |
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | |
| | | }
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | private void CreateWishGroup()
|
| | | {
|
| | | var operation = wishModel.GetOperationWishing();
|
| | | if (operation == null) return;
|
| | | wishGroupCtrl.Refresh();
|
| | | foreach(var key in operation.wellItemDict.Keys)
|
| | | {
|
| | | wishGroupCtrl.AddCell(ScrollerDataType.Header,key);
|
| | | }
|
| | | wishGroupCtrl.Restart();
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fe79dd1562e90624bb7c5e2443363897 |
| | | timeCreated: 1540193204 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | _leftRifht = Config.Instance.Get<TreasureConfig>(model.selectedTreasure - 1);
|
| | | m_LeftBtn.gameObject.SetActive(_leftRifht != null);
|
| | | var skillLevelUpRedpointTreasure = model.GetSkillLevelUpRedpointTreasure();
|
| | | m_LeftRedpoint.gameObject.SetActive(skillLevelUpRedpointTreasure != 0
|
| | | && model.selectedTreasure > skillLevelUpRedpointTreasure && model.currentCategory == TreasureCategory.Human);
|
| | | m_RightRedpoint.gameObject.SetActive(skillLevelUpRedpointTreasure != 0
|
| | | && model.selectedTreasure < skillLevelUpRedpointTreasure && model.currentCategory == TreasureCategory.Human);
|
| | | m_LeftRedpoint.gameObject.SetActive(false);
|
| | | m_RightRedpoint.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | private void HideHuman()
|
| | |
| | | private void SkillLevelUpRedpointUpdate()
|
| | | {
|
| | | var skillLevelUpRedpointTreasure = model.GetSkillLevelUpRedpointTreasure();
|
| | | m_LeftRedpoint.gameObject.SetActive(skillLevelUpRedpointTreasure != 0
|
| | | && model.selectedTreasure > skillLevelUpRedpointTreasure && model.currentCategory == TreasureCategory.Human);
|
| | | m_RightRedpoint.gameObject.SetActive(skillLevelUpRedpointTreasure != 0
|
| | | && model.selectedTreasure < skillLevelUpRedpointTreasure && model.currentCategory == TreasureCategory.Human);
|
| | | m_LeftRedpoint.gameObject.SetActive(false);
|
| | | m_RightRedpoint.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | protected override void LateUpdate()
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 许愿池
|
| | | /// </summary>
|
| | | /// <param name="package"></param>
|
| | | public void UpdateWishingWellInfo(HAA19_tagMCActWishingWellInfo package)
|
| | | {
|
| | | OperationBase operationBase = null;
|
| | | operationDict.TryGetValue(Operation.WishingWellInfo, out operationBase);
|
| | | if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
|
| | | {
|
| | | ForceStopOperation(Operation.WishingWellInfo);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (operationBase == null)
|
| | | {
|
| | | operationBase = new OperationWishingWellInfo();
|
| | | operationDict.Add(Operation.WishingWellInfo, operationBase);
|
| | | }
|
| | | OperationWishingWellInfo operation = operationBase as OperationWishingWellInfo;
|
| | | operation.Reset();
|
| | | operation.limitLv = package.LimitLV;
|
| | | operation.startDate = ParseOperationDate(package.StartDate);
|
| | | operation.endDate = ParseOperationDate(package.EndtDate);
|
| | | operation.dayReset = package.IsDayReset == 1;
|
| | | operation.ParsePackage(package);
|
| | | if (operationTimeUpdateEvent != null)
|
| | | {
|
| | | operationTimeUpdateEvent(Operation.WishingWellInfo);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 限时礼包
|
| | | /// </summary>
|
| | | /// <param name="package"></param>
|
| | |
| | | FairyCeremony, //仙界盛典
|
| | | MultipRealmPoint, //N倍修行点
|
| | | FlashRushToBuy, //限时抢购
|
| | | WishingWellInfo, //许愿池
|
| | | max,
|
| | | }
|
| | | }
|
| | |
| | | RegisterModel<FlashRushToBuyModel>();
|
| | | RegisterModel<TalentModel>();
|
| | | RegisterModel<OpenServerActivityNotifyModel>();
|
| | | RegisterModel<WishingPoolModel>();
|
| | | inited = true;
|
| | | }
|
| | |
|