8604 子 【港台】1.0.1【BT】【长尾】新增限时集字活动 / 【港台】【BT】【长尾】【前端】新增限时集字活动 - 未完成
| | |
| | | Register(typeof(HAA28_tagMCRechargePrizePlayerInfo), typeof(DTCAA28_tagMCRechargePrizePlayerInfo));
|
| | | Register(typeof(HAA27_tagMCActRechargePrizeInfo), typeof(DTCAA27_tagMCActRechargePrizeInfo));
|
| | |
|
| | | Register(typeof(HAA40_tagMCActCollectWordsInfo), typeof(DTCAA40_tagMCActCollectWordsInfo));
|
| | | Register(typeof(HAA41_tagMCActCollectWordsPlayerInfo), typeof(DTCAA41_tagMCActCollectWordsPlayerInfo));
|
| | | }
|
| | |
|
| | | //注册lua 的分包
|
| | |
| | | /// </summary>
|
| | | /// <param name="vBytes"></param>
|
| | | /// <returns></returns>
|
| | | public static GameNetPackBasic TransPack(ServerType socketType, ushort cmd, byte[] vBytes)
|
| | | public static GameNetPackBasic TransPack(ServerType socketType, ushort cmd, byte[] vBytes, bool isLuaParse = false)
|
| | | {
|
| | | #if UNITY_EDITOR
|
| | | int length = vBytes.Length;
|
| | |
| | | else
|
| | | {
|
| | | #if UNITY_EDITOR
|
| | | NetPkgCtl.RecordPackage(socketType, vStr, NetPackagetType.Server, string.Empty, string.Empty, null);
|
| | | NetPkgCtl.RecordPackage(socketType, vStr, NetPackagetType.Server, string.Empty, string.Empty, null, isLuaParse);
|
| | | #endif
|
| | | }
|
| | | return null;
|
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // AA 09 集字活动兑换 #tagCMActCollectWordsExchange |
| | | |
| | | public class CAA09_tagCMActCollectWordsExchange : GameNetPackBasic { |
| | | public byte ActNum; //活动编号,1 或 2,相互独立的活动,可同时开启 |
| | | public byte ExchangeNum; //兑换编号 |
| | | |
| | | public CAA09_tagCMActCollectWordsExchange () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xAA09; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (ActNum, NetDataType.BYTE); |
| | | WriteBytes (ExchangeNum, NetDataType.BYTE); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 98d5ccb56cb0da74cbb96a078637e1f2 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using Snxxz.UI; |
| | | // AA 40 集字活动信息 #tagMCActCollectWordsInfo |
| | | |
| | | public class DTCAA40_tagMCActCollectWordsInfo : DtcBasic { |
| | | public override void Done(GameNetPackBasic vNetPack) { |
| | | base.Done(vNetPack); |
| | | HAA40_tagMCActCollectWordsInfo vNetData = vNetPack as HAA40_tagMCActCollectWordsInfo; |
| | | OperationTimeHepler.Instance.UpdateCollectWordsPackage(vNetData); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: dea694329a97a1642a902a990c19976c |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using Snxxz.UI; |
| | | // AA 41 集字活动玩家信息 #tagMCActCollectWordsPlayerInfo |
| | | |
| | | public class DTCAA41_tagMCActCollectWordsPlayerInfo : DtcBasic { |
| | | public override void Done(GameNetPackBasic vNetPack) { |
| | | base.Done(vNetPack); |
| | | HAA41_tagMCActCollectWordsPlayerInfo vNetData = vNetPack as HAA41_tagMCActCollectWordsPlayerInfo; |
| | | |
| | | ModelCenter.Instance.GetModel<CollectWordsModel>().UpdateExchangeInfo(vNetData); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 033b80740a6d5e7478a0cd89b28e0b1e |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | private static List<NetPackage> tempPackages = new List<NetPackage>();//暂停时缓存的封包列表
|
| | | public static bool stopRecieve = false;
|
| | |
|
| | | public static void RecordPackage(ServerType socketType, string bytes, NetPackagetType packType, string packageName, string fields, List<string> fieldDetails)
|
| | | public static void RecordPackage(ServerType socketType, string bytes, NetPackagetType packType, string packageName, string fields, List<string> fieldDetails, bool isLuaParse = false)
|
| | | {
|
| | | #if UNITY_EDITOR
|
| | | var package = new NetPackage();
|
| | |
| | | var byteStr = package.content.Split(' ');
|
| | | if (byteStr.Length > 1)
|
| | | {
|
| | | package.name = StringUtility.Contact("H", byteStr[0], byteStr[1], "(未注册)");
|
| | | if (isLuaParse)
|
| | | {
|
| | | package.name = StringUtility.Contact("H", byteStr[0], byteStr[1], "(LUA注册)");
|
| | | }
|
| | | else
|
| | | { |
| | | package.name = StringUtility.Contact("H", byteStr[0], byteStr[1], "(未注册)");
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // AA 40 集字活动信息 #tagMCActCollectWordsInfo |
| | | |
| | | public class HAA40_tagMCActCollectWordsInfo : GameNetPackBasic { |
| | | public byte ActNum; //活动编号,1 或 2,相互独立的活动,可同时开启 |
| | | public string StartDate; // 开始日期 y-m-d |
| | | public string EndtDate; // 结束日期 y-m-d |
| | | public ushort LimitLV; // 限制等级 |
| | | public byte LastDayOnlyExchange; //最后一天是否仅兑换 |
| | | public byte ExchangeCount; |
| | | public tagMCActCollectWordsExchangeItem[] ExchangeItemList; //兑换组合列表 |
| | | |
| | | public HAA40_tagMCActCollectWordsInfo () { |
| | | _cmd = (ushort)0xAA40; |
| | | } |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | TransBytes (out ActNum, vBytes, NetDataType.BYTE); |
| | | TransBytes (out StartDate, vBytes, NetDataType.Chars, 10); |
| | | TransBytes (out EndtDate, vBytes, NetDataType.Chars, 10); |
| | | TransBytes (out LimitLV, vBytes, NetDataType.WORD); |
| | | TransBytes (out LastDayOnlyExchange, vBytes, NetDataType.BYTE); |
| | | TransBytes (out ExchangeCount, vBytes, NetDataType.BYTE); |
| | | ExchangeItemList = new tagMCActCollectWordsExchangeItem[ExchangeCount]; |
| | | for (int i = 0; i < ExchangeCount; i ++) { |
| | | ExchangeItemList[i] = new tagMCActCollectWordsExchangeItem(); |
| | | TransBytes (out ExchangeItemList[i].ExchangeNum, vBytes, NetDataType.BYTE); |
| | | TransBytes (out ExchangeItemList[i].ExchangeCountMax, vBytes, NetDataType.BYTE); |
| | | TransBytes (out ExchangeItemList[i].ItemID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out ExchangeItemList[i].ItemCount, vBytes, NetDataType.WORD); |
| | | TransBytes (out ExchangeItemList[i].IsBind, vBytes, NetDataType.BYTE); |
| | | TransBytes (out ExchangeItemList[i].NeedItemCount, vBytes, NetDataType.BYTE); |
| | | ExchangeItemList[i].NeedItemList = new tagMCActCollectWordsNeedItem[ExchangeItemList[i].NeedItemCount]; |
| | | for (int j = 0; j < ExchangeItemList[i].NeedItemCount; j ++) { |
| | | ExchangeItemList[i].NeedItemList[j] = new tagMCActCollectWordsNeedItem(); |
| | | TransBytes (out ExchangeItemList[i].NeedItemList[j].ItemID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out ExchangeItemList[i].NeedItemList[j].ItemCount, vBytes, NetDataType.WORD); |
| | | TransBytes (out ExchangeItemList[i].NeedItemList[j].IsBind, vBytes, NetDataType.BYTE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public struct tagMCActCollectWordsNeedItem { |
| | | public uint ItemID; |
| | | public ushort ItemCount; |
| | | public byte IsBind; |
| | | } |
| | | |
| | | public struct tagMCActCollectWordsExchangeItem { |
| | | public byte ExchangeNum; //兑换编号 |
| | | public byte ExchangeCountMax; //最大兑换次数,0不限制 |
| | | public uint ItemID; //目标物品 |
| | | public ushort ItemCount; |
| | | public byte IsBind; |
| | | public byte NeedItemCount; |
| | | public tagMCActCollectWordsNeedItem[] NeedItemList; // 所需物品列表 |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 11f1e0b4561698745bad8115d007ff69 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // AA 41 集字活动玩家信息 #tagMCActCollectWordsPlayerInfo |
| | | |
| | | public class HAA41_tagMCActCollectWordsPlayerInfo : GameNetPackBasic { |
| | | public byte ActNum; //活动编号,1 或 2,相互独立的活动,可同时开启 |
| | | public byte ExchangeCount; |
| | | public tagMCActCollectWordsExchangeInfo[] ExchangeInfoList; //兑换数据列表 |
| | | |
| | | public HAA41_tagMCActCollectWordsPlayerInfo () { |
| | | _cmd = (ushort)0xAA41; |
| | | } |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | TransBytes (out ActNum, vBytes, NetDataType.BYTE); |
| | | TransBytes (out ExchangeCount, vBytes, NetDataType.BYTE); |
| | | ExchangeInfoList = new tagMCActCollectWordsExchangeInfo[ExchangeCount]; |
| | | for (int i = 0; i < ExchangeCount; i ++) { |
| | | ExchangeInfoList[i] = new tagMCActCollectWordsExchangeInfo(); |
| | | TransBytes (out ExchangeInfoList[i].ExchangeNum, vBytes, NetDataType.BYTE); |
| | | TransBytes (out ExchangeInfoList[i].ExchangeCount, vBytes, NetDataType.WORD); |
| | | } |
| | | } |
| | | |
| | | public struct tagMCActCollectWordsExchangeInfo { |
| | | public byte ExchangeNum; //兑换编号 |
| | | public ushort ExchangeCount; //已兑换次数 |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: da5e35ecc80f685469e60aa142413e0d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | vPackBytes = encoder.BaseXorSub(vPackBytes); |
| | | Array.Copy(vPackBytes, 0, vCmdBytes, 0, 2); |
| | | var cmd = (ushort)((ushort)(vCmdBytes[0] << 8) + vCmdBytes[1]); |
| | | bool isRegist = false; // 未注册封包处理 |
| | | if (PackageRegedit.Contain(cmd)) |
| | | { |
| | | vNetpack = PackageRegedit.TransPack(socketType, cmd, vPackBytes); |
| | |
| | | |
| | | m_LastPackageTime = DateTime.Now; |
| | | GameNetSystem.Instance.PushPackage(vNetpack, this.socketType); |
| | | isRegist = true; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //处理lua的分包 |
| | | if (PackageRegedit.ContainLua(cmd)) |
| | | { |
| | | #if UNITY_EDITOR |
| | | PackageRegedit.TransPack(socketType, cmd, vPackBytes); |
| | | PackageRegedit.TransPack(socketType, cmd, vPackBytes, true); |
| | | #endif |
| | | var luaNetPack = new LuaGameNetPack(cmd, vPackBytes); |
| | | luaNetPack.socketType = this.socketType; |
| | | GameNetSystem.Instance.PushPackage(luaNetPack, this.socketType); |
| | | isRegist = true; |
| | | } |
| | | |
| | | vReadIndex += 6 + vBodyLeng; |
| | | |
| | | // 未注册封包处理 |
| | | if (!isRegist) |
| | | { |
| | | #if UNITY_EDITOR |
| | | PackageRegedit.TransPack(socketType, cmd, vPackBytes); |
| | | #endif |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using Snxxz.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class CollectWordsCell : CellView |
| | | { |
| | | Button ExChangeBtn; |
| | | Text ExChangeCnt; |
| | | Transform CollectLayout; |
| | | ItemCell itemCell; |
| | | Image Img_Complete; |
| | | LayoutGroup Layout; |
| | | |
| | | CollectWordsModel model |
| | | { |
| | | get { return ModelCenter.Instance.GetModel<CollectWordsModel>(); } |
| | | } |
| | | PackModel packModel |
| | | { |
| | | get { return ModelCenter.Instance.GetModel<PackModel>(); } |
| | | } |
| | | |
| | | protected override void Awake() |
| | | { |
| | | base.Awake(); |
| | | ExChangeBtn = GetWidgt<Button>("ExChangeBtn"); |
| | | ExChangeCnt = GetWidgt<Text>("ExChangeCnt"); |
| | | CollectLayout = GetWidgt<Transform>("CollectLayout"); |
| | | itemCell = GetWidgt<ItemCell>("itemCell"); |
| | | Img_Complete = GetWidgt<Image>("Img_Complete"); |
| | | Layout = GetWidgt<LayoutGroup>("Layout"); |
| | | } |
| | | |
| | | |
| | | |
| | | //按钮 |
| | | //数量不足 按钮灰色不可点击 |
| | | //可兑换 按钮亮起可点击 |
| | | //达兑换上限 隐藏按钮显示上限 |
| | | public void Display(int index) |
| | | { |
| | | OperationCollectWords operation; |
| | | if (!OperationTimeHepler.Instance.TryGetOperation(Operation.CollectWords, out operation)) |
| | | { |
| | | return; |
| | | } |
| | | if (index >= operation.exchangeWords.Count) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var exchangeNum = operation.exchangeWords[index].ExchangeNum; //编号 |
| | | var maxNum = operation.exchangeWords[index].ExchangeCountMax; |
| | | |
| | | bool isEnough = true; //是否能兑换 |
| | | //物品 |
| | | for (int i = 0; i < operation.exchangeWords[index].NeedItemCount; i++) |
| | | { |
| | | var itemID = (int)operation.exchangeWords[index].NeedItemList[i].ItemID; |
| | | var itemCnt = operation.exchangeWords[index].NeedItemList[i].ItemCount; |
| | | var isBind = operation.exchangeWords[index].NeedItemList[i].IsBind; |
| | | |
| | | GameObject go = null; |
| | | if (i >= CollectLayout.childCount) |
| | | { |
| | | go = Instantiate(UILoader.LoadPrefab("ItemCell")); |
| | | go.transform.SetParent(CollectLayout); |
| | | go.transform.localScale = Vector3.one; |
| | | Vector3 pos = go.transform.localPosition; |
| | | go.transform.localPosition = pos.SetZ(0); |
| | | } |
| | | else |
| | | { |
| | | go = CollectLayout.GetChild(i).gameObject; |
| | | } |
| | | go.gameObject.SetActive(true); |
| | | ItemCell item = go.GetComponent<ItemCell>(); |
| | | item.format = ItemCellformat.Format_80x80; |
| | | var cnt = packModel.GetItemCountByID(PackType.Item, itemID); |
| | | ItemCellModel cellModel = new ItemCellModel(itemID); |
| | | item.Init(cellModel); |
| | | item.countText.text = cnt + "/" + itemCnt; |
| | | if (cnt < itemCnt) |
| | | { |
| | | isEnough = false; |
| | | } |
| | | item.button.RemoveAllListeners(); |
| | | item.button.AddListener(() => |
| | | { |
| | | ItemTipUtility.Show(itemID); |
| | | }); |
| | | } |
| | | |
| | | // cell是共用的 拖拉之后 childCount产生变化,需要屏蔽 |
| | | for (int i = operation.exchangeWords[index].NeedItemCount; i < CollectLayout.childCount; i++) |
| | | { |
| | | CollectLayout.GetChild(i).gameObject.SetActive(false); |
| | | } |
| | | |
| | | int exchangedCnt; //已兑换次数 |
| | | model.exchangeDict.TryGetValue(exchangeNum, out exchangedCnt); |
| | | |
| | | Img_Complete.gameObject.SetActive(exchangedCnt >= maxNum); |
| | | ExChangeBtn.gameObject.SetActive(exchangedCnt < maxNum); |
| | | ExChangeBtn.SetColorful(null, isEnough); |
| | | ExChangeBtn.interactable = isEnough; |
| | | var tagItemID = (int)operation.exchangeWords[index].ItemID; |
| | | ItemCellModel tagCellModel = new ItemCellModel(tagItemID, false, (ulong)operation.exchangeWords[index].ItemCount); |
| | | itemCell.Init(tagCellModel); |
| | | itemCell.button.RemoveAllListeners(); |
| | | itemCell.button.AddListener(() => |
| | | { |
| | | ItemTipUtility.Show(tagItemID); |
| | | }); |
| | | |
| | | ExChangeCnt.text = Language.Get("CollectWordsLimit", exchangedCnt, maxNum); |
| | | if (this.gameObject.activeInHierarchy) |
| | | { |
| | | StartCoroutine(UpdateLayout(CollectLayout as RectTransform)); |
| | | StartCoroutine(UpdateLayout(Layout.GetComponent<RectTransform>())); |
| | | } |
| | | } |
| | | |
| | | IEnumerator UpdateLayout(RectTransform rect) |
| | | { |
| | | yield return new WaitForEndOfFrame(); |
| | | LayoutRebuilder.ForceRebuildLayoutImmediate(rect); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3df1a79766daa69449ac412ad0c0d419 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 活动界面-集字 和精彩活动表关联 |
| | | /// </summary> |
| | | namespace Snxxz.UI |
| | | { |
| | | public class CollectWordsModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity |
| | | { |
| | | Operation collectWordsType = Operation.CollectWords; |
| | | int regesitType = 30; |
| | | public bool IsOpen |
| | | { |
| | | get |
| | | { |
| | | return OperationTimeHepler.Instance.SatisfyOpenCondition(collectWordsType); |
| | | } |
| | | } |
| | | |
| | | public bool IsAdvance |
| | | { |
| | | get |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public bool priorityOpen |
| | | { |
| | | get { return redpoint.state == RedPointState.Simple; } |
| | | } |
| | | |
| | | |
| | | public event Action ExChangeInfoUpdate; |
| | | public event Action<int> onStateUpdate; |
| | | //已兑换的记录 |
| | | public Dictionary<int, int> exchangeDict = new Dictionary<int, int>(); |
| | | public byte actNum; //对应界面 |
| | | |
| | | public override void Init() |
| | | { |
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent; |
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent; |
| | | OperationTimeHepler.Instance.dayResetEvent += DayResetEvent; |
| | | OpenServerActivityCenter.Instance.Register(regesitType, this); |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | exchangeDict.Clear(); |
| | | } |
| | | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | UpdateRedpoint(); |
| | | } |
| | | |
| | | public override void UnInit() |
| | | { |
| | | OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent; |
| | | OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent; |
| | | OperationTimeHepler.Instance.dayResetEvent -= DayResetEvent; |
| | | } |
| | | |
| | | private void DayResetEvent(int resetType) |
| | | { |
| | | OperationBase operationBase; |
| | | if (OperationTimeHepler.Instance.TryGetOperationTime(collectWordsType, out operationBase)) |
| | | { |
| | | if (resetType == operationBase.resetType) |
| | | { |
| | | UpdateRedpoint(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void OperationEndEvent(Operation operationType, int state) |
| | | { |
| | | if (operationType == collectWordsType && state == 0) |
| | | { |
| | | UpdateRedpoint(); |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(regesitType); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void OperationStartEvent(Operation operationType, int state) |
| | | { |
| | | if (operationType == collectWordsType && state == 0) |
| | | { |
| | | UpdateRedpoint(); |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(regesitType); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #region 服务端数据 |
| | | |
| | | public void UpdateExchangeInfo(HAA41_tagMCActCollectWordsPlayerInfo package) |
| | | { |
| | | OperationCollectWords operation; |
| | | if (OperationTimeHepler.Instance.TryGetOperation(Operation.CollectWords, out operation)) |
| | | { |
| | | if (operation.ActNum != package.ActNum) |
| | | { |
| | | return; |
| | | } |
| | | actNum = package.ActNum; |
| | | for (int i = 0; i < package.ExchangeCount; i++) |
| | | { |
| | | //已兑换次数 |
| | | exchangeDict[package.ExchangeInfoList[i].ExchangeNum] = package.ExchangeInfoList[i].ExchangeCount; |
| | | } |
| | | UpdateRedpoint(); |
| | | if (ExChangeInfoUpdate != null) |
| | | { |
| | | ExChangeInfoUpdate(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 红点 |
| | | public Redpoint redpoint = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, 20930); |
| | | public bool isOpenWin = false; |
| | | public void UpdateRedpoint() |
| | | { |
| | | redpoint.state = RedPointState.None; |
| | | if (!IsOpen) |
| | | { |
| | | return; |
| | | } |
| | | OperationBase operationBase; |
| | | if (OperationTimeHepler.Instance.TryGetOperationTime(collectWordsType, out operationBase)) |
| | | { |
| | | redpoint.state = isOpenWin ? RedPointState.None : RedPointState.Simple; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4e1b644e884df174092573463a68f6dd |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Monday, January 28, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class CollectWordsWin : Window |
| | | { |
| | | ScrollerController collectScroll; |
| | | Text m_OpenTime; |
| | | Text m_Info; |
| | | |
| | | CollectWordsModel model |
| | | { |
| | | get { return ModelCenter.Instance.GetModel<CollectWordsModel>(); } |
| | | } |
| | | |
| | | |
| | | #region Built-in |
| | | protected override void BindController() |
| | | { |
| | | collectScroll = GetWidgt<ScrollerController>("CollectScroll"); |
| | | m_OpenTime = GetWidgt<Text>("CoolDownTxt"); |
| | | m_Info = GetWidgt<Text>("Info"); |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | collectScroll.OnRefreshCell += OnRefreshCell; |
| | | |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | } |
| | | #endregion |
| | | |
| | | void Display() |
| | | { |
| | | DisplayOpenTime(); |
| | | DisplayCollect(); |
| | | } |
| | | |
| | | |
| | | void DisplayCollect() |
| | | { |
| | | OperationCollectWords operation; |
| | | if (!OperationTimeHepler.Instance.TryGetOperation(Operation.CollectWords, out operation)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | collectScroll.Refresh(); |
| | | for (int i = 0; i< operation.exchangeWords.Count; i++) |
| | | { |
| | | collectScroll.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | collectScroll.Restart(); |
| | | } |
| | | |
| | | |
| | | void DisplayOpenTime() |
| | | { |
| | | m_Info.gameObject.SetActive(false); |
| | | OperationCollectWords operation; |
| | | if (OperationTimeHepler.Instance.TryGetOperation(Operation.CollectWords, out operation)) |
| | | { |
| | | m_OpenTime.text = StringUtility.Contact(Language.Get("ExpActivity_Text1"), operation.ToDisplayTime()); |
| | | |
| | | //最后一天特殊说明 |
| | | if (operation.LastDayOnlyExchange > 0) |
| | | { |
| | | m_Info.gameObject.SetActive(true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | |
| | | var collectWordCell = cell as CollectWordsCell; |
| | | collectWordCell.Display(cell.index); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a89c1f686c8ca9b4cbfb98fc01be144f |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | namespace Snxxz.UI |
| | | { |
| | | public class OperationCollectWords : OperationBase |
| | | { |
| | | public byte ActNum; //活动编号 对应不同界面 1:常规运营活动(开服) 2:合服 |
| | | public byte LastDayOnlyExchange; //最后一天是否只兑换不掉落 |
| | | |
| | | //兑换列表 编号:兑换信息 |
| | | public List<HAA40_tagMCActCollectWordsInfo.tagMCActCollectWordsExchangeItem> exchangeWords = |
| | | new List<HAA40_tagMCActCollectWordsInfo.tagMCActCollectWordsExchangeItem>(); |
| | | |
| | | public override bool SatisfyOpenCondition() |
| | | { |
| | | return PlayerDatas.Instance.baseData.LV >= limitLv; |
| | | } |
| | | |
| | | 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 override void Reset() |
| | | { |
| | | base.Reset(); |
| | | exchangeWords.Clear(); |
| | | } |
| | | |
| | | public void ParseCollectWords(HAA40_tagMCActCollectWordsInfo package) |
| | | { |
| | | exchangeWords.Clear(); |
| | | for (int i = 0; i < package.ExchangeCount; i++) |
| | | { |
| | | exchangeWords.Add(package.ExchangeItemList[i]); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 23ac6a019557794408c6939eda9ab274 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | } |
| | | } |
| | | |
| | | private void Awake() |
| | | { |
| | | } |
| | | |
| | | private void Start() |
| | | { |
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateCollectWordsPackage(HAA40_tagMCActCollectWordsInfo package)
|
| | | {
|
| | | OperationBase operationBase = null;
|
| | |
|
| | | var opreationType = Operation.CollectWords;
|
| | |
|
| | | switch (package.ActNum)
|
| | | {
|
| | | case 1:
|
| | | opreationType = Operation.CollectWords;
|
| | | break;
|
| | | }
|
| | |
|
| | | operationDict.TryGetValue(opreationType, out operationBase);
|
| | | if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
|
| | | {
|
| | | ForceStopOperation(opreationType);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (operationBase == null)
|
| | | {
|
| | | operationBase = new OperationCollectWords();
|
| | | operationDict.Add(opreationType, operationBase);
|
| | | }
|
| | | OperationCollectWords operation = operationBase as OperationCollectWords;
|
| | | operation.Reset();
|
| | | operation.limitLv = package.LimitLV;
|
| | | operation.startDate = ParseOperationDate(package.StartDate);
|
| | | operation.endDate = ParseOperationDate(package.EndtDate);
|
| | | operation.ActNum = package.ActNum;
|
| | | operation.LastDayOnlyExchange = package.LastDayOnlyExchange;
|
| | | operation.ParseCollectWords(package);
|
| | | if (operationTimeUpdateEvent != null)
|
| | | {
|
| | | operationTimeUpdateEvent(opreationType);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateMultiRechargePackage(HAA27_tagMCActRechargePrizeInfo package)
|
| | | {
|
| | |
| | | MultiRecharge, //仙玉充值返利 (首充双倍)
|
| | | CZBMGift, // 成长必买礼包
|
| | | DaysAccumulateRecharge, //累计充值,多日
|
| | | CollectWords, //收集文字
|
| | | max,
|
| | | }
|
| | | }
|
| | |
| | | RegisterModel<ExchangeActiveTokenModel>();
|
| | | RegisterModel<AddUpRechargeModel>();
|
| | | RegisterModel<BossFirstBloodModel>();
|
| | | RegisterModel<CollectWordsModel>();
|
| | | inited = true;
|
| | | }
|
| | |
|
| | |
| | | protected Dictionary<string, GameObject> dicWidgts; |
| | | |
| | | /// <summary> |
| | | /// 在基类合适地方初始化此方法 |
| | | /// 在子类合适地方初始化此方法 |
| | | /// </summary> |
| | | protected void InitWidgts() |
| | | { |
| | |
| | | case JumpUIType.DayPackage:
|
| | | case JumpUIType.OpenServer_SuperUP:
|
| | | case JumpUIType.OpenServer_DaysAccumulateRecharge:
|
| | | case JumpUIType.OpenServer_JZHF:
|
| | | SetJumpLogic<OpenServerActivityWin>(_tagWinSearchModel.TABID);
|
| | | break;
|
| | | case JumpUIType.OpenServerRank:
|
| | |
| | | }
|
| | | }
|
| | | break;
|
| | | case JumpUIType.OpenServer_JZYY:
|
| | | {
|
| | | if (!OpenServerActivityCenter.Instance.IsActivityOpen(_tagWinSearchModel.TABID))
|
| | | {
|
| | | OperationTimeHepler.Instance.ProcessConditionError(Operation.CollectWords);
|
| | | return false;
|
| | | }
|
| | | }
|
| | | break;
|
| | |
|
| | | case JumpUIType.OpenServer_SuperUP:
|
| | | {
|
| | | if (!OpenServerActivityCenter.Instance.IsActivityOpen(_tagWinSearchModel.TABID))
|
| | |
| | | OpenServer_SuperUP = 368, //超级助力
|
| | | OpenServer_DaysAccumulateRecharge = 369, //多日累充
|
| | |
|
| | | OpenServer_JZYY = 400, //集字 活动界面
|
| | | OpenServer_JZHF = 401, //集字 合服界面
|
| | |
|
| | | DhszTs = 1001,//定海神针功法提升界面
|
| | | HyqTs = 1002,//皓月枪功法提升界面
|
| | | GyzTs = 1003,//鬼牙刃功法提升界面
|
| | |
| | | /// <summary> |
| | | /// This is the base class that all cell views should derive from |
| | | /// </summary> |
| | | public class EnhancedScrollerCellView : MonoBehaviour |
| | | public class EnhancedScrollerCellView : WidgetBehavior |
| | | { |
| | | /// <summary> |
| | | /// The cellIdentifier is a unique string that allows the scroller |
| | |
| | | /// You can override it to update your cell's view UID |
| | | /// </summary> |
| | | public virtual void RefreshCellView() { }//当主动调用EnhancedScrller类中RefreshActiveCellViews()方法时,会遍历当前处于Active状态的CellVeiw,并调用它们重写的这个方法 |
| | | //这个方法可以用于主动刷新当前处于Active状态的CellVeiw |
| | | //这个方法可以用于主动刷新当前处于Active状态的CellVeiw |
| | | |
| | | protected virtual void Awake() |
| | | { |
| | | InitWidgts(); |
| | | } |
| | | } |
| | | } |