Merge branch 'master' into ILRuntime
| | |
| | |
|
| | | Register(typeof(HAA40_tagMCActCollectWordsInfo), typeof(DTCAA40_tagMCActCollectWordsInfo));
|
| | | Register(typeof(HAA41_tagMCActCollectWordsPlayerInfo), typeof(DTCAA41_tagMCActCollectWordsPlayerInfo));
|
| | |
|
| | | #region 节日祝福
|
| | | Register(typeof(HAA42_tagMCFeastLoginInfo), typeof(DTCAA42_tagMCFeastLoginInfo));
|
| | | Register(typeof(HAA39_tagMCFeastLoginPlayerInfo), typeof(DTCAA39_tagMCFeastLoginPlayerInfo));
|
| | |
|
| | | #endregion
|
| | | }
|
| | |
|
| | | //注册lua的封包
|
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //A5 04 玩家领取奖励 #tagCMPlayerGetReward
|
| | |
|
| | | public class CA504_tagCMPlayerGetReward : GameNetPackBasic {
|
| | | public byte RewardType; //奖励类型
|
| | | public uint DataEx; //附带信息
|
| | | public byte DataExStrLen; //附加字符信息长度
|
| | | public string DataExStr; //附加字符信息
|
| | |
|
| | | public CA504_tagCMPlayerGetReward () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA504;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (RewardType, NetDataType.BYTE);
|
| | | WriteBytes (DataEx, NetDataType.DWORD);
|
| | | WriteBytes (DataExStrLen, NetDataType.BYTE);
|
| | | WriteBytes (DataExStr, NetDataType.Chars, DataExStrLen);
|
| | | }
|
| | |
|
| | | }
|
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | //A5 04 玩家领取奖励 #tagCMPlayerGetReward |
| | | |
| | | public class CA504_tagCMPlayerGetReward : GameNetPackBasic { |
| | | public byte RewardType; //奖励类型 |
| | | public uint DataEx; //附带信息 |
| | | public byte DataExStrLen; //附加字符信息长度 |
| | | public string DataExStr; //附加字符信息 |
| | | |
| | | public CA504_tagCMPlayerGetReward () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA504; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (RewardType, NetDataType.BYTE); |
| | | WriteBytes (DataEx, NetDataType.DWORD); |
| | | WriteBytes (DataExStrLen, NetDataType.BYTE); |
| | | WriteBytes (DataExStr, NetDataType.Chars, DataExStrLen); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using Snxxz.UI; |
| | | |
| | | // AA 39 节日登录奖励活动玩家信息 #tagMCFeastLoginPlayerInfo |
| | | |
| | | public class DTCAA39_tagMCFeastLoginPlayerInfo : DtcBasic { |
| | | |
| | | HolidayLoginModel model { get { return ModelCenter.Instance.GetModel<HolidayLoginModel>(); } } |
| | | |
| | | public override void Done(GameNetPackBasic vNetPack) { |
| | | base.Done(vNetPack); |
| | | HAA39_tagMCFeastLoginPlayerInfo vNetData = vNetPack as HAA39_tagMCFeastLoginPlayerInfo; |
| | | |
| | | model.UpdateLoginInfo(vNetData); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 03e40141b5868484993722e676674395 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using Snxxz.UI; |
| | | |
| | | // AA 42 节日登录奖励活动信息 #tagMCFeastLoginInfo |
| | | |
| | | public class DTCAA42_tagMCFeastLoginInfo : DtcBasic { |
| | | public override void Done(GameNetPackBasic vNetPack) { |
| | | base.Done(vNetPack); |
| | | HAA42_tagMCFeastLoginInfo vNetData = vNetPack as HAA42_tagMCFeastLoginInfo; |
| | | OperationTimeHepler.Instance.UpdateHolidayLogin(vNetData); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 935445a4ef3dc7642b0542f61c6ca0ef |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // AA 39 节日登录奖励活动玩家信息 #tagMCFeastLoginPlayerInfo |
| | | |
| | | public class HAA39_tagMCFeastLoginPlayerInfo : GameNetPackBasic { |
| | | public uint LoginState; // 是否已登录,按天索引0代表第1天记录当天是否已登录 |
| | | public uint LoginAward; // 是否已领取,按天索引0代表第1天记录当天是否已领取 |
| | | |
| | | public HAA39_tagMCFeastLoginPlayerInfo () { |
| | | _cmd = (ushort)0xAA39; |
| | | } |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | TransBytes (out LoginState, vBytes, NetDataType.DWORD); |
| | | TransBytes (out LoginAward, vBytes, NetDataType.DWORD); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 89505510f0e0df048bad8576810e18b8 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // AA 42 节日登录奖励活动信息 #tagMCFeastLoginInfo |
| | | |
| | | public class HAA42_tagMCFeastLoginInfo : GameNetPackBasic { |
| | | public string StartDate; // 开始日期 y-m-d |
| | | public string EndtDate; // 结束日期 y-m-d |
| | | public byte DayCount; // 总共几天 |
| | | public tagMCFeastLoginDayAward[] DayAwardList; //登录天奖励列表 |
| | | |
| | | public HAA42_tagMCFeastLoginInfo () { |
| | | _cmd = (ushort)0xAA42; |
| | | } |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | TransBytes (out StartDate, vBytes, NetDataType.Chars, 10); |
| | | TransBytes (out EndtDate, vBytes, NetDataType.Chars, 10); |
| | | TransBytes (out DayCount, vBytes, NetDataType.BYTE); |
| | | DayAwardList = new tagMCFeastLoginDayAward[DayCount]; |
| | | for (int i = 0; i < DayCount; i ++) { |
| | | DayAwardList[i] = new tagMCFeastLoginDayAward(); |
| | | TransBytes (out DayAwardList[i].DayNum, vBytes, NetDataType.BYTE); |
| | | TransBytes (out DayAwardList[i].AwardCount, vBytes, NetDataType.BYTE); |
| | | DayAwardList[i].AwardItemList = new tagMCFeastLoginDayAwardItem[DayAwardList[i].AwardCount]; |
| | | for (int j = 0; j < DayAwardList[i].AwardCount; j ++) { |
| | | DayAwardList[i].AwardItemList[j] = new tagMCFeastLoginDayAwardItem(); |
| | | TransBytes (out DayAwardList[i].AwardItemList[j].ItemID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out DayAwardList[i].AwardItemList[j].ItemCount, vBytes, NetDataType.WORD); |
| | | TransBytes (out DayAwardList[i].AwardItemList[j].IsBind, vBytes, NetDataType.BYTE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public struct tagMCFeastLoginDayAward { |
| | | public byte DayNum; //天编号,从1开始,活动第X天只能领对应第X天的奖励 |
| | | public byte AwardCount; |
| | | public tagMCFeastLoginDayAwardItem[] AwardItemList; // 奖励物品列表 |
| | | } |
| | | |
| | | public struct tagMCFeastLoginDayAwardItem { |
| | | public uint ItemID; |
| | | public ushort ItemCount; |
| | | public byte IsBind; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 25e1ec7ff51885e4c9633ed92ada2b3d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3b6f29be066e78141a002c2ddd7b8079 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, September 26, 2018 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | namespace Snxxz.UI { |
| | | |
| | | public class HolidayLoginDayCell : CellView { |
| | | [SerializeField] Text m_Day;//天数 |
| | | [SerializeField] Text m_IconName;//名字 |
| | | [SerializeField] ItemCell itemCell; |
| | | [SerializeField] UIEffect m_UIeffect; |
| | | [SerializeField] Button m_FuncBtn; |
| | | [SerializeField] Image m_ImageSelect; |
| | | //选中的背景变化 特效用于可领取的显示 |
| | | |
| | | HolidayLoginModel model { get { return ModelCenter.Instance.GetModel<HolidayLoginModel>(); } } |
| | | |
| | | public Button funcBtn |
| | | { |
| | | get |
| | | { |
| | | return m_FuncBtn; |
| | | } |
| | | } |
| | | |
| | | |
| | | public void Display(int index) |
| | | { |
| | | OperationHolidayLogin holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(Operation.HolidayLogin, out holiday); |
| | | |
| | | m_Day.text = Language.Get("SignIn_4", Language.Get("Num_CHS_" + holiday.loginAwards[index].DayNum)); |
| | | //第一个为标的物 |
| | | int itemID = (int)holiday.loginAwards[index].AwardItemList[0].ItemID; |
| | | var config = ItemConfig.Get(itemID); |
| | | var itemData = new ItemCellModel(itemID, false, 1); |
| | | itemCell.Init(itemData); |
| | | |
| | | m_IconName.text = config.ItemName; |
| | | |
| | | m_UIeffect.Stop(); |
| | | if (model.GetLoginAwardState(holiday.loginAwards[index].DayNum) == 1) |
| | | { |
| | | m_UIeffect.Play(); |
| | | } |
| | | |
| | | m_ImageSelect.gameObject.SetActive(model.selectIndex == index); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 39118569ce1e5dd4ca0edc3c1bc0c67d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | public class HolidayLoginModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity |
| | | { |
| | | public event Action<int> onStateUpdate; |
| | | public const int redPointID = 28001; |
| | | public Redpoint redPoint = new Redpoint(MainRedDot.RedPoint_HolidayWishes, redPointID); |
| | | |
| | | private uint LoginState; //活动期间的登录状态 |
| | | private uint LoginAwardState; //领取状态 |
| | | |
| | | //节日祝福 id从101开始和精彩活动区分 |
| | | public const int activityType = (int)OpenServerActivityCenter.ActivityType.AT_JRZF; |
| | | public const int activityID = 101; |
| | | |
| | | public int selectIndex = 0; //被选中的天 |
| | | |
| | | public event Action UpdateHolidayLogin; //节日登录 |
| | | |
| | | public override void Init() |
| | | { |
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent; |
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent; |
| | | OperationTimeHepler.Instance.operationAdvanceEvent += OperationAdvanceEvent; |
| | | OpenServerActivityCenter.Instance.Register(activityID, this, activityType); |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | } |
| | | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | } |
| | | |
| | | public override void UnInit() |
| | | { |
| | | |
| | | } |
| | | |
| | | public bool IsOpen { |
| | | get { |
| | | return OperationTimeHepler.Instance.SatisfyOpenCondition(Operation.HolidayLogin); |
| | | } |
| | | } |
| | | |
| | | public bool priorityOpen { |
| | | get { |
| | | return redPoint.state == RedPointState.Simple; |
| | | } |
| | | } |
| | | |
| | | public bool IsAdvance { |
| | | get { |
| | | return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.HolidayLogin); |
| | | } |
| | | } |
| | | |
| | | private void OperationEndEvent(Operation type, int state) |
| | | { |
| | | if (type == Operation.HolidayLogin && state == 0) |
| | | { |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void OperationAdvanceEvent(Operation type) |
| | | { |
| | | if (type == Operation.HolidayLogin) |
| | | { |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void OperationStartEvent(Operation type, int state) |
| | | { |
| | | if (type == Operation.HolidayLogin && state == 0) |
| | | { |
| | | |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //0 不可领取 1 可领取 2 已领取 |
| | | public int GetLoginAwardState(int day) |
| | | { |
| | | //校验登录 |
| | | if (((int)Math.Pow(2, day - 1) & LoginState) == 0) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | if (((int)Math.Pow(2, day - 1) & LoginAwardState) == 0) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | return 2; |
| | | } |
| | | |
| | | void UpdateRedpoint() |
| | | { |
| | | OperationHolidayLogin holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(Operation.HolidayLogin, out holiday); |
| | | redPoint.state = RedPointState.None; |
| | | |
| | | for (int i = 0; i < holiday.loginAwards.Count; i++) |
| | | { |
| | | if (GetLoginAwardState(holiday.loginAwards[i].DayNum) == 1) |
| | | { |
| | | redPoint.state = RedPointState.Simple; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void UpdateLoginInfo(HAA39_tagMCFeastLoginPlayerInfo netPack) |
| | | { |
| | | LoginState = netPack.LoginState; |
| | | LoginAwardState = netPack.LoginAward; |
| | | if (UpdateHolidayLogin != null) |
| | | UpdateHolidayLogin(); |
| | | |
| | | UpdateRedpoint(); |
| | | } |
| | | |
| | | public void SendGetAward(uint day) |
| | | { |
| | | CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward(); |
| | | getReward.RewardType = (byte)GotServerRewardType.Def_RewardType_HolidayLogin; |
| | | getReward.DataEx = day; |
| | | getReward.DataExStrLen = 0; |
| | | getReward.DataExStr = string.Empty; |
| | | GameNetSystem.Instance.SendInfo(getReward); |
| | | } |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 24ace09813332b64abe559699879ccf4 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Thursday, April 18, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class HolidayLoginWin : Window |
| | | { |
| | | Image DayImg; |
| | | ScrollerController m_Controller; // 登录天 |
| | | List<ItemCell> items = new List<ItemCell>(); |
| | | Button GetGift; |
| | | Image GotYet; |
| | | Text ShowDayInfo; //可领天数说明 |
| | | |
| | | List<int> displayItems = new List<int>(); |
| | | HolidayLoginModel model { get { return ModelCenter.Instance.GetModel<HolidayLoginModel>(); } } |
| | | |
| | | |
| | | #region Built-in |
| | | protected override void BindController() |
| | | { |
| | | DayImg = GetWidgt<Image>("DayWord"); |
| | | m_Controller = GetWidgt<ScrollerController>("ScrollerControl"); |
| | | items.Clear(); |
| | | |
| | | for (int i = 0; i < 6; i++) |
| | | { |
| | | var itemCell = GetWidgt<ItemCell>("ItemCell" + i); |
| | | items.Add(itemCell); |
| | | } |
| | | |
| | | GetGift = GetWidgt<Button>("ReceiveAwardBtn"); |
| | | GotYet = GetWidgt<Image>("AlreadyReceivedImage"); |
| | | ShowDayInfo = GetWidgt<Text>("TimeRemaining"); |
| | | |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | m_Controller.OnRefreshCell += OnRefreshCell; |
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent += OperationTimeUpdateEvent; |
| | | model.UpdateHolidayLogin += UpdateHolidayLogin; |
| | | model.selectIndex = GetDefaultSelect(); |
| | | DisplayScroll(); |
| | | DisplayDayAward(); |
| | | } |
| | | |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | m_Controller.OnRefreshCell -= OnRefreshCell; |
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent -= OperationTimeUpdateEvent; |
| | | model.UpdateHolidayLogin -= UpdateHolidayLogin; |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | void DisplayScroll() |
| | | { |
| | | m_Controller.Refresh(); |
| | | OperationHolidayLogin holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(Operation.HolidayLogin, out holiday); |
| | | |
| | | for (int i = 0; i < holiday.loginAwards.Count; i++) |
| | | { |
| | | m_Controller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | m_Controller.Restart(); |
| | | m_Controller.m_Scorller.RefreshActiveCellViews(); |
| | | m_Controller.JumpIndex(model.selectIndex); |
| | | } |
| | | |
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | if (type != ScrollerDataType.Header) return; |
| | | |
| | | var _cell = cell as HolidayLoginDayCell; |
| | | _cell.funcBtn.AddListener(() => |
| | | { |
| | | model.selectIndex = cell.index; |
| | | DisplayDayAward(); |
| | | m_Controller.m_Scorller.RefreshActiveCellViews(); |
| | | }); |
| | | |
| | | _cell.Display(_cell.index); |
| | | |
| | | } |
| | | |
| | | void UpdateHolidayLogin() |
| | | { |
| | | DisplayDayAward(); |
| | | } |
| | | |
| | | private void OperationTimeUpdateEvent(Operation type) |
| | | { |
| | | if (type == Operation.HolidayLogin) |
| | | { |
| | | DisplayScroll(); |
| | | DisplayDayAward(); |
| | | } |
| | | } |
| | | |
| | | void DisplayDayAward() |
| | | { |
| | | OperationHolidayLogin holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(Operation.HolidayLogin, out holiday); |
| | | DayImg.SetSprite("cnum" + holiday.loginAwards[model.selectIndex].DayNum); |
| | | DayImg.SetNativeSize(); |
| | | |
| | | var awards = holiday.loginAwards[model.selectIndex].AwardItemList; |
| | | for (int i = 0; i < items.Count; i++) |
| | | { |
| | | if (i < awards.Length) |
| | | { |
| | | var award = awards[i]; |
| | | items[i].gameObject.SetActive(true); |
| | | var itemData = new ItemCellModel((int)award.ItemID, false, award.ItemCount); |
| | | items[i].Init(itemData); |
| | | items[i].button.SetListener(()=> { |
| | | ItemTipUtility.Show((int)award.ItemID); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | items[i].gameObject.SetActive(false); |
| | | } |
| | | } |
| | | var state = model.GetLoginAwardState(holiday.loginAwards[model.selectIndex].DayNum); |
| | | GetGift.gameObject.SetActive(state == 1); |
| | | GetGift.SetListener(()=> { |
| | | model.SendGetAward(holiday.loginAwards[model.selectIndex].DayNum); |
| | | }); |
| | | GotYet.gameObject.SetActive(state == 2); |
| | | ShowDayInfo.gameObject.SetActive(state == 0); |
| | | if (state == 0) |
| | | { |
| | | int curDayIndex = GetTodayIndex(); |
| | | if (curDayIndex + 1 == model.selectIndex) |
| | | ShowDayInfo.text = Language.Get("Tomorrow_Draw"); |
| | | else |
| | | ShowDayInfo.text = Language.Get("Rest_Time", model.selectIndex - curDayIndex); |
| | | } |
| | | } |
| | | |
| | | //优先选择可领取的,然后是已领取的下一天 |
| | | int GetDefaultSelect() |
| | | { |
| | | OperationHolidayLogin holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(Operation.HolidayLogin, out holiday); |
| | | |
| | | int getYet = -1; |
| | | for (int i = 0; i < holiday.loginAwards.Count; i++) |
| | | { |
| | | var state = model.GetLoginAwardState(i+1); |
| | | if (state == 1) |
| | | return i; |
| | | if (state == 2) |
| | | getYet = i; |
| | | } |
| | | return Math.Min(getYet + 1, holiday.loginAwards.Count - 1); |
| | | |
| | | } |
| | | |
| | | //获取当前登录天 |
| | | int GetTodayIndex() |
| | | { |
| | | OperationHolidayLogin holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(Operation.HolidayLogin, out holiday); |
| | | |
| | | int index = 0; |
| | | for (int i = 0; i < holiday.loginAwards.Count; i++) |
| | | { |
| | | var state = model.GetLoginAwardState(i + 1); |
| | | if (state == 1 || state == 2) |
| | | index = i; |
| | | } |
| | | return index; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2d74d65df691f7448b1d0b79b42164a7 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Thursday, April 18, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace Snxxz.UI { |
| | | |
| | | public class HolidayWishesWin : OneLevelWin |
| | | { |
| | | #region Built-in |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | base.AddListeners(); |
| | | SetFunctionListener(0, ShowLoginWin); |
| | | SetFunctionListener(1, ShowAlchemyNormalDrug); |
| | | SetFunctionListener(2, ShowAlchemyFairy); |
| | | SetFunctionListener(3, ShowAlchemyFairyDrug); |
| | | } |
| | | |
| | | protected override void OnActived() |
| | | { |
| | | base.OnActived(); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | base.OnPreOpen(); |
| | | SetFunctionButtonActive(0, true); |
| | | SetFunctionButtonActive(1, true); |
| | | SetFunctionButtonActive(2, true); |
| | | SetFunctionButtonActive(3, true); |
| | | |
| | | if (!OpenServerActivityCenter.Instance.IsActivityOpen(101, (int)OpenServerActivityCenter.ActivityType.AT_JRZF)) |
| | | { |
| | | SetFunctionButtonActive(0, false); |
| | | } |
| | | |
| | | if (!OpenServerActivityCenter.Instance.IsActivityOpen(102, (int)OpenServerActivityCenter.ActivityType.AT_JRZF)) |
| | | { |
| | | SetFunctionButtonActive(1, false); |
| | | } |
| | | |
| | | if (!OpenServerActivityCenter.Instance.IsActivityOpen(103, (int)OpenServerActivityCenter.ActivityType.AT_JRZF)) |
| | | { |
| | | SetFunctionButtonActive(2, false); |
| | | } |
| | | |
| | | if (!OpenServerActivityCenter.Instance.IsActivityOpen(104, (int)OpenServerActivityCenter.ActivityType.AT_JRZF)) |
| | | { |
| | | SetFunctionButtonActive(3, false); |
| | | } |
| | | |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | CloseSubWindows(); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | private void ShowLoginWin() |
| | | { |
| | | CloseSubWindows(); |
| | | WindowCenter.Instance.Open<HolidayLoginWin>(); |
| | | functionOrder = 0; |
| | | } |
| | | |
| | | private void ShowAlchemyNormalDrug() |
| | | { |
| | | CloseSubWindows(); |
| | | WindowCenter.Instance.Open<AlchemyNormalUseDrugWin>(); |
| | | functionOrder = 1; |
| | | } |
| | | |
| | | private void ShowAlchemyFairy() |
| | | { |
| | | CloseSubWindows(); |
| | | WindowCenter.Instance.Open<AlchemyFairyDrugWin>(); |
| | | functionOrder = 2; |
| | | } |
| | | |
| | | private void ShowAlchemyFairyDrug() |
| | | { |
| | | CloseSubWindows(); |
| | | WindowCenter.Instance.Open<AlchemyFairyUseDrugWin>(); |
| | | functionOrder = 3; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 69e9a8b76ea606b4bad000303ee46e37 |
| | | 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 OperationHolidayLogin : OperationBase |
| | | { |
| | | public List<HAA42_tagMCFeastLoginInfo.tagMCFeastLoginDayAward> loginAwards = new List<HAA42_tagMCFeastLoginInfo.tagMCFeastLoginDayAward>(); |
| | | |
| | | 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(); |
| | | } |
| | | |
| | | public void ParsePackage(HAA42_tagMCFeastLoginInfo package) |
| | | { |
| | | loginAwards.Clear(); |
| | | for (int i = 0; i < package.DayCount; i++) |
| | | { |
| | | loginAwards.Add(package.DayAwardList[i]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c0cacc823aaf624429028843c0295a84 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | var wayConfig = GetItemWaysConfig.Get(way); |
| | | if (wayConfig.FuncOpenId == 0 || FuncOpen.Instance.IsFuncOpen(wayConfig.FuncOpenId)) |
| | | { |
| | | if (wayConfig.ActiveType == -1 || OpenServerActivityCenter.Instance.IsActivityOpen(wayConfig.ActiveType)) |
| | | int activityType = 0; // 活动模板 参考OpenServerActivityCenter.ActivityType |
| | | if (wayConfig.customize == 2) |
| | | { |
| | | activityType = (int)OpenServerActivityCenter.ActivityType.AT_JRZF; |
| | | } |
| | | else if (wayConfig.customize == 3) |
| | | { |
| | | activityType = (int)OpenServerActivityCenter.ActivityType.AT_HFHD; |
| | | } |
| | | if (wayConfig.ActiveType == -1 || OpenServerActivityCenter.Instance.IsActivityOpen(wayConfig.ActiveType, activityType)) |
| | | { |
| | | getWay.ways.Add(way); |
| | | } |
| | |
| | | //顶层面板框按钮
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | |
| | | public class HighSettingTip : MonoBehaviour
|
| | | {
|
| | | [SerializeField] Button _DaTreasureBtn;//打宝按钮
|
| | |
| | | [SerializeField] Button m_OpenServiceBtn;//周狂欢按钮
|
| | | [SerializeField] Button m_NewYearBtn;//新年盛典
|
| | | [SerializeField] Button m_HazyRegion;
|
| | |
|
| | | [SerializeField] Button m_HolidayWishes;
|
| | |
|
| | |
|
| | | private bool isNeedTip = true;
|
| | |
|
| | |
| | | _CZFLBtn.SetListener(()=> {
|
| | | WindowCenter.Instance.Open<AddUpRechargeWin>();
|
| | | });
|
| | | m_HolidayWishes.SetListener(OpenHolidayWishes);
|
| | | }
|
| | |
|
| | | public void Init()
|
| | |
| | | WindowCenter.Instance.Open<OpenServerActivityWin>();
|
| | | }
|
| | |
|
| | | void OpenHolidayWishes() //节日祝福
|
| | | {
|
| | | HighSettingFadeInFadeOut.SetAutoCloseTimer();
|
| | | WindowCenter.Instance.Open<HolidayWishesWin>();
|
| | | }
|
| | |
|
| | | void ShoppingButton()//商城按钮
|
| | | {
|
| | | if (FuncOpen.Instance.IsFuncOpen(79))
|
| | |
| | | #region 开服活动红点
|
| | | public const int REDPOINT_OPENSERVER = 209;
|
| | | public Redpoint openServerRedpoint = new Redpoint(REDPOINT_OPENSERVER);
|
| | |
|
| | | //280 开头用于节日祝福
|
| | | public const int RedPoint_HolidayWishes = 280;
|
| | | public Redpoint holidayWishesRedpoint = new Redpoint(RedPoint_HolidayWishes);
|
| | |
|
| | | #endregion
|
| | | public const int REDPOINT_OPENRANK = 258;
|
| | | public Redpoint openRankRedpoint = new Redpoint(REDPOINT_OPENRANK);
|
| | |
| | | public class MainWinTopGrid : MonoBehaviour |
| | | { |
| | | [SerializeField] bool m_AlwayShow; |
| | | // 配置逻辑参考 IsOpen 函数 |
| | | [SerializeField] int m_FunctionId; |
| | | [SerializeField] int m_ActivityType = 0; //活动模板 |
| | | [SerializeField] int m_OpenServerActivityType = 100; |
| | | [SerializeField] bool m_IsAnyOpenServerActivity = false; |
| | | [SerializeField] Operation m_OperationActivityType = Operation.max; |
| | |
| | | return FuncOpen.Instance.IsFuncOpen(m_FunctionId); |
| | | } |
| | | |
| | | //默认100为不判定 |
| | | if (m_OpenServerActivityType != 100) |
| | | { |
| | | return OpenServerActivityCenter.Instance.IsActivityOpen(m_OpenServerActivityType); |
| | | return OpenServerActivityCenter.Instance.IsActivityOpen(m_OpenServerActivityType, m_ActivityType); |
| | | } |
| | | |
| | | if (m_IsAnyOpenServerActivity) |
| | | { |
| | | var functionOrder = 0; |
| | | return OpenServerActivityCenter.Instance.IsAnyActivityOpen(out functionOrder); |
| | | return OpenServerActivityCenter.Instance.IsAnyActivityOpen(out functionOrder, m_ActivityType); |
| | | } |
| | | |
| | | if (m_OperationActivityType != Operation.max) |
| | |
| | | using UnityEngine; |
| | | namespace Snxxz.UI
|
| | | {
|
| | | //修改成控制多个活动模块,如精彩活动模板1,精彩活动模板2
|
| | | [XLua.LuaCallCSharp]
|
| | | public class OpenServerActivityCenter : Singleton<OpenServerActivityCenter>
|
| | | {
|
| | | public event Action openServerActivityStateChange;
|
| | |
|
| | | Dictionary<int, IOpenServerActivity> openServerActivitys = new Dictionary<int, IOpenServerActivity>();
|
| | | Dictionary<int, ILuaOpenServerActivity> luaOpenServerAcitivitys = new Dictionary<int, ILuaOpenServerActivity>();
|
| | | //{活动模板:{活动ID:活动接口}}
|
| | | Dictionary<int, Dictionary<int, IOpenServerActivity>> GameServerActivitys = new Dictionary<int, Dictionary<int, IOpenServerActivity>>();
|
| | |
|
| | | public int selectFuncOrder = -1;
|
| | |
|
| | | public enum ActivityType
|
| | | {
|
| | | AT_JCHD = 0, //精彩活动
|
| | | AT_JRZF, //节日祝福
|
| | | AT_HFHD, //合服活动
|
| | | AT_Activity1, //预备活动1
|
| | | AT_Activity2, //预备活动2
|
| | | AT_Activity3, //预备活动3
|
| | | }
|
| | |
|
| | | public OpenServerActivityCenter()
|
| | | {
|
| | | TimeUtility.OnServerOpenDayRefresh += OnServerOpenDayRefresh;
|
| | | }
|
| | |
|
| | | public void Register(int funcOrder, IOpenServerActivity activity)
|
| | | public void Register(int funcOrder, IOpenServerActivity activity, int activityType = (int)ActivityType.AT_JCHD)
|
| | | {
|
| | | if (!GameServerActivitys.ContainsKey(activityType))
|
| | | {
|
| | | GameServerActivitys.Add(activityType, new Dictionary<int, IOpenServerActivity>());
|
| | | }
|
| | |
|
| | | var openServerActivitys = GameServerActivitys[activityType];
|
| | | if (!openServerActivitys.ContainsKey(funcOrder))
|
| | | {
|
| | | openServerActivitys.Add(funcOrder, activity);
|
| | | activity.onStateUpdate += OnStateUpdate;
|
| | | }
|
| | | }
|
| | |
|
| | | public void RegisterLuaActivity(int funcOrder, string luaTableName)
|
| | | {
|
| | | if (!openServerActivitys.ContainsKey(funcOrder))
|
| | | {
|
| | | var activity = LuaUtility.Global.Get<IOpenServerActivity>(luaTableName);
|
| | | if (activity != null)
|
| | | {
|
| | | openServerActivitys.Add(funcOrder, activity);
|
| | | activity.onStateUpdate += OnStateUpdate;
|
| | | }
|
| | |
|
| | | var luaActivity = LuaUtility.Global.Get<ILuaOpenServerActivity>(luaTableName);
|
| | | if (luaActivity != null)
|
| | | {
|
| | | luaOpenServerAcitivitys[funcOrder] = luaActivity;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public bool IsAnyActivityOpen(out int _functionOrder)
|
| | | public bool IsAnyActivityOpen(out int _functionOrder, int activityType=(int)ActivityType.AT_JCHD)
|
| | | {
|
| | | if (!GameServerActivitys.ContainsKey(activityType))
|
| | | {
|
| | | GameServerActivitys.Add(activityType, new Dictionary<int, IOpenServerActivity>());
|
| | | }
|
| | |
|
| | | var openServerActivitys = GameServerActivitys[activityType];
|
| | | _functionOrder = 0;
|
| | | foreach (var _order in openServerActivitys.Keys)
|
| | | {
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | public bool IsActivityOpen(int _funcOrder)
|
| | | public bool IsActivityOpen(int _funcOrder, int activityType=(int)ActivityType.AT_JCHD)
|
| | | {
|
| | | if (!GameServerActivitys.ContainsKey(activityType))
|
| | | {
|
| | | GameServerActivitys.Add(activityType, new Dictionary<int, IOpenServerActivity>());
|
| | | }
|
| | |
|
| | | var openServerActivitys = GameServerActivitys[activityType];
|
| | | if (openServerActivitys.ContainsKey(_funcOrder))
|
| | | {
|
| | | return openServerActivitys[_funcOrder].IsOpen || openServerActivitys[_funcOrder].IsAdvance;
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | public bool IsPriorityOpenOpen(int _funcOrder)
|
| | | public bool IsPriorityOpenOpen(int _funcOrder, int activityType = (int)ActivityType.AT_JCHD)
|
| | | {
|
| | | if (!GameServerActivitys.ContainsKey(activityType))
|
| | | {
|
| | | GameServerActivitys.Add(activityType, new Dictionary<int, IOpenServerActivity>());
|
| | | }
|
| | |
|
| | | var openServerActivitys = GameServerActivitys[activityType];
|
| | | if (openServerActivitys.ContainsKey(_funcOrder))
|
| | | {
|
| | | return openServerActivitys[_funcOrder].priorityOpen;
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | public void SetSelectDefaultChildType(int _funcOrder)
|
| | | {
|
| | | if (luaOpenServerAcitivitys.ContainsKey(_funcOrder))
|
| | | {
|
| | | luaOpenServerAcitivitys[_funcOrder].SetSelectDefaultChildType();
|
| | | }
|
| | | }
|
| | |
|
| | | public bool ExistChildBookmark(int _funcOrder)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public int GetChildSelectType(int _funcOrder)
|
| | | {
|
| | | if (luaOpenServerAcitivitys.ContainsKey(_funcOrder))
|
| | | {
|
| | | return luaOpenServerAcitivitys[_funcOrder].selectType;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public int[] GetChildTypes(int _funcOrder)
|
| | | {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public void SetSelectChildType(int _funcOrder, int type)
|
| | | {
|
| | | if (luaOpenServerAcitivitys.ContainsKey(_funcOrder))
|
| | | {
|
| | | luaOpenServerAcitivitys[_funcOrder].SetSelectChildType(type);
|
| | | }
|
| | | }
|
| | |
|
| | | public void ProcessErrorTip()
|
| | | {
|
| | |
| | | event Action<int> onStateUpdate;
|
| | | }
|
| | |
|
| | | [XLua.CSharpCallLua]
|
| | | public interface ILuaOpenServerActivity
|
| | | {
|
| | | int selectType { get; }
|
| | | void SetSelectDefaultChildType();
|
| | | void SetSelectChildType(int type);
|
| | | }
|
| | | } |
| | | |
| | |
| | | if (OpenServerActivityCenter.Instance.IsPriorityOpenOpen(activityId)) |
| | | { |
| | | priorityActivitys.Add(activityId); |
| | | |
| | | OpenServerActivityCenter.Instance.SetSelectDefaultChildType(activityId); |
| | | } |
| | | } |
| | | } |
| | |
| | | {
|
| | | monthWeekInvestModel.selectType = monthWeekInvestModel.GetSelectType();
|
| | | }
|
| | | else
|
| | | {
|
| | | OpenServerActivityCenter.Instance.SetSelectDefaultChildType(functionOrder);
|
| | | }
|
| | | |
| | | UpdateFunctionBtns();
|
| | | }
|
| | | OnOpenActivity(functionOrder);
|
| | |
| | | monthWeekInvestModel.selectType = monthWeekInvestModel.GetSelectType();
|
| | | break;
|
| | | default:
|
| | | OpenServerActivityCenter.Instance.SetSelectDefaultChildType(activityId);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | _cell.SetSelect(_type == monthWeekInvestModel.selectType);
|
| | | break;
|
| | | default:
|
| | | _cell.titleTxt.text = Language.Get(StringUtility.Contact("OpenServerActivityChild_", _order, "_", _type));
|
| | | _cell.SetSelect(_type == OpenServerActivityCenter.Instance.GetChildSelectType(_order));
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | monthWeekInvestModel.selectType = _type;
|
| | | break;
|
| | | default:
|
| | | OpenServerActivityCenter.Instance.SetSelectChildType(_order, _type);
|
| | | break;
|
| | | }
|
| | | m_ActivityCtrl.m_Scorller.RefreshActiveCellViews();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateHolidayLogin(HAA42_tagMCFeastLoginInfo package)
|
| | | {
|
| | | OperationBase operationBase = null;
|
| | | operationDict.TryGetValue(Operation.HolidayLogin, out operationBase);
|
| | | if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
|
| | | {
|
| | | ForceStopOperation(Operation.HolidayLogin);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (operationBase == null)
|
| | | {
|
| | | operationBase = new OperationHolidayLogin();
|
| | | operationDict.Add(Operation.HolidayLogin, operationBase);
|
| | | }
|
| | | var operation = operationBase as OperationHolidayLogin;
|
| | | operation.Reset();
|
| | | operation.startDate = ParseOperationDate(package.StartDate);
|
| | | operation.endDate = ParseOperationDate(package.EndtDate);
|
| | | operation.ParsePackage(package);
|
| | | if (operationTimeUpdateEvent != null)
|
| | | {
|
| | | operationTimeUpdateEvent(Operation.HolidayLogin);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | public void UpdateMultiRechargePackage(HAA27_tagMCActRechargePrizeInfo package)
|
| | | {
|
| | | OperationBase operationBase = null;
|
| | |
| | | CZBMGift, // 成长必买礼包
|
| | | DaysAccumulateRecharge, //累计充值,多日
|
| | | CollectWords, //收集文字
|
| | | HolidayLogin, //节日登录
|
| | | max,
|
| | | }
|
| | | }
|
| | |
| | | RegisterModel<AddUpRechargeModel>();
|
| | | RegisterModel<BossFirstBloodModel>();
|
| | | RegisterModel<CollectWordsModel>();
|
| | |
|
| | | RegisterModel<HolidayLoginModel>();
|
| | |
|
| | | inited = true;
|
| | | }
|
| | |
|
| | |
| | | m_Group.SetFunctionListener(order, callBack); |
| | | } |
| | | |
| | | public void SetFunctionButtonActive(int order, bool isShow) |
| | | { |
| | | m_Group.SetFunctionButtonActive(order, isShow); |
| | | } |
| | | |
| | | private void OnPlayerDataUpdate(PlayerDataType type) |
| | | { |
| | | switch (type) |
| | |
| | | } |
| | | } |
| | | |
| | | public void SetFunctionButtonActive(int order, bool isShow)
|
| | | { |
| | | if (functionButtons.ContainsKey(order)) |
| | | { |
| | | functionButtons[order].gameObject.SetActive(isShow); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | Def_RewardType_HistoryChargeAward = 28,//累计充值
|
| | | Def_RewardType_DayPackageFree = 29,//每日免费礼包
|
| | | Def_RewardType_ActivityPlace = 30,//活跃放置奖励
|
| | |
|
| | | Def_RewardType_HolidayLogin = 37,//节日登录奖励
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|