10301 子 【越南】【英语】【BT】【砍树】仙缘 / 【越南】【英语】【BT】【砍树】仙缘-客户端
| | |
| | | base.Done(vNetPack);
|
| | | HAA70_tagMCActLoginPlayerInfoNew vNetData = vNetPack as HAA70_tagMCActLoginPlayerInfoNew;
|
| | | ModelCenter.Instance.GetModel<LoginActModel>().UpdateLoginInfo(vNetData);
|
| | | ModelCenter.Instance.GetModel<FairyAffinityLoginActModel>().UpdateLoginInfo(vNetData);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public class DTCAA72_tagMCActTaskPlayerValueInfo : DtcBasic {
|
| | | MissionActModel model { get { return ModelCenter.Instance.GetModel<MissionActModel>(); } }
|
| | | FairyAffinityMissionActModel fairyAffinityMissionActModel { get { return ModelCenter.Instance.GetModel<FairyAffinityMissionActModel>(); } }
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HAA72_tagMCActTaskPlayerValueInfo vNetData = vNetPack as HAA72_tagMCActTaskPlayerValueInfo;
|
| | | model.UpdateMissionPlayerValueInfo(vNetData);
|
| | | fairyAffinityMissionActModel.UpdateMissionPlayerValueInfo(vNetData);
|
| | | }
|
| | | }
|
| | |
| | | public class DTCAA73_tagMCActTaskPlayerInfo : DtcBasic {
|
| | |
|
| | | MissionActModel model { get { return ModelCenter.Instance.GetModel<MissionActModel>(); } }
|
| | | FairyAffinityMissionActModel fairyAffinityMissionActModel { get { return ModelCenter.Instance.GetModel<FairyAffinityMissionActModel>(); } }
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HAA73_tagMCActTaskPlayerInfo vNetData = vNetPack as HAA73_tagMCActTaskPlayerInfo;
|
| | | model.UpdateMissionPlayerInfo(vNetData);
|
| | | fairyAffinityMissionActModel.UpdateMissionPlayerInfo(vNetData);
|
| | | }
|
| | | }
|
| | |
| | | RechargeGiftActModel model { get { return ModelCenter.Instance.GetModel<RechargeGiftActModel>(); } }
|
| | | RechargeGiftAct31Model model31 { get { return ModelCenter.Instance.GetModel<RechargeGiftAct31Model>(); } }
|
| | | CustomizedGiftModel customizedGiftModel { get { return ModelCenter.Instance.GetModel<CustomizedGiftModel>(); } }
|
| | | FairyAffinityRechargeGiftActModel fairyAffinityRechargeGiftActModel { get { return ModelCenter.Instance.GetModel<FairyAffinityRechargeGiftActModel>(); } }
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HAA75_tagMCActBuyCountGiftPlayerInfo vNetData = vNetPack as HAA75_tagMCActBuyCountGiftPlayerInfo;
|
| | | model.UpdateBuyCountGiftPlayerInfo(vNetData);
|
| | | customizedGiftModel.UpdateBuyCountGiftPlayerInfo(vNetData);
|
| | | model31.UpdateBuyCountGiftPlayerInfo(vNetData);
|
| | | fairyAffinityRechargeGiftActModel.UpdateBuyCountGiftPlayerInfo(vNetData);
|
| | | }
|
| | | }
|
| | |
| | | ModelCenter.Instance.GetModelEx<MountedPetZhanLingModel>().UpdateGiftState(vNetData);
|
| | | ModelCenter.Instance.GetModelEx<GuBaoCultivateZhanLingModel>().UpdateGiftState(vNetData);
|
| | | ModelCenter.Instance.GetModelEx<PhantasmPavilionZhanLingModel>().UpdateGiftState(vNetData);
|
| | | ModelCenter.Instance.GetModelEx<FairyAffinityZhanLingModel>().UpdateGiftState(vNetData);
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e50f6cde844f4264fb6d3d8e10199b0f |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 634529047dcf64c4ea2fe3759e3157ef |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | public class FairyAffinityCoolTime : MonoBehaviour |
| | | { |
| | | [SerializeField] Text m_Time; |
| | | [SerializeField] Image m_bg; |
| | | |
| | | private void OnEnable() |
| | | { |
| | | GlobalTimeEvent.Instance.secondEvent += RefreshSecond; |
| | | RefreshSecond(); |
| | | } |
| | | |
| | | private void OnDisable() |
| | | { |
| | | GlobalTimeEvent.Instance.secondEvent -= RefreshSecond; |
| | | } |
| | | |
| | | private void RefreshSecond() |
| | | { |
| | | m_bg.SetActive(true);
|
| | | m_Time.SetActive(true); |
| | | int seconds = OperationTimeHepler.Instance.GetOperationSurplusTime(Operation.default44); |
| | | if (seconds > 0) |
| | | { |
| | | if (seconds < 86400)
|
| | | {
|
| | | m_Time.text = StringUtility.Contact("<color=#8DDC11FF>", TimeUtility.SecondsToHMS(seconds), "</color>");
|
| | | }
|
| | | else
|
| | | {
|
| | | m_bg.SetActive(false);
|
| | | m_Time.SetActive(false);
|
| | | } |
| | | } |
| | | else |
| | | { |
| | | m_Time.text = UIHelper.AppendColor(TextColType.Red, Language.Get("XMZZ110")); |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 454ecb249ad3f4943843bc3accafd40b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, September 26, 2018 |
| | | //-------------------------------------------------------- |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class FairyAffinityLoginActCell : CellView
|
| | | { |
| | | [SerializeField] Text m_Day;//天数
|
| | | |
| | | //itemCells freeGrays freeLocks freeHaves 个数需要相等 |
| | | [SerializeField] List<ItemCell> itemCells; |
| | |
|
| | | [SerializeField] List<ImageEx> freeGrays;
|
| | | [SerializeField] List<ImageEx> freeLocks;
|
| | | [SerializeField] List<ImageEx> freeHaves;
|
| | |
|
| | | //itemCellExs paidGrays paidLocks paidHaves 个数需要相等
|
| | | [SerializeField] List<ItemCell> itemCellExs;
|
| | |
|
| | | [SerializeField] List<ImageEx> paidGrays;
|
| | | [SerializeField] List<ImageEx> paidLocks;
|
| | | [SerializeField] List<ImageEx> paidHaves;
|
| | |
|
| | | [SerializeField] Button getGiftBtn; |
| | | [SerializeField] Image gotYetImg; |
| | | [SerializeField] Button reSignBtn; |
| | | [SerializeField] Text waitSignText;
|
| | | [SerializeField] Button btnLateSign;
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } } |
| | | FairyAffinityLoginActModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityLoginActModel>(); } }
|
| | |
|
| | | public void Display(int index) |
| | | { |
| | | OperationLoginAct holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityLoginActModel.operaType, out holiday);
|
| | | int dayNum = holiday.loginAwards[index].DayNum; |
| | | //0 不可领取(日期未到) 1 可领取 2 已领取 3补签(已过天) 4 继续签到(已购买) 5 继续签到(未购买) |
| | | var state = model.GetLoginAwardState(dayNum); |
| | | m_Day.text = Language.Get("loginact3", dayNum);
|
| | |
|
| | | waitSignText.SetActive(state == 0);
|
| | |
|
| | | getGiftBtn.SetActive(state == 1); |
| | | getGiftBtn.SetListener(() =>
|
| | | { |
| | | model.SendGetAward(dayNum); |
| | | });
|
| | |
|
| | | gotYetImg.SetActive(state == 2);
|
| | |
|
| | | reSignBtn.SetActive(state == 3); |
| | | |
| | | btnLateSign.SetActive(state == 4 || state == 5); |
| | | btnLateSign.SetListener(() =>
|
| | | { |
| | | if (state == 4)
|
| | | {
|
| | | model.SendGetAwardEx(dayNum);
|
| | | }
|
| | | else
|
| | | {
|
| | | vipModel.CTG(holiday.awardExCTGID);
|
| | | } |
| | | }); |
| | | |
| | | reSignBtn.SetListener(() =>
|
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
|
| | | Language.Get("loginact2", holiday.costValue + RichTextMsgReplaceConfig.GetRichReplace("MONEY", holiday.costType)), (bool isOk) =>
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | if (UIHelper.GetMoneyCnt(holiday.costType) < (ulong)holiday.costValue)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("LackMoney", holiday.costType);
|
| | | if (holiday.costType == 1)
|
| | | {
|
| | | WindowCenter.Instance.Open<RechargeTipWin>();
|
| | | }
|
| | | return;
|
| | | }
|
| | | model.SendGetAward(dayNum);
|
| | | }
|
| | | });
|
| | | }); |
| | | |
| | | var awards = holiday.loginAwards[index].AwardItemList; |
| | | for (int i = 0; i < itemCells.Count; i++) |
| | | { |
| | | if (i < awards.Length) |
| | | { |
| | | var award = awards[i]; |
| | | itemCells[i].SetActive(true); |
| | | var itemData = new ItemCellModel((int)award.ItemID, false, award.ItemCount); |
| | | itemCells[i].Init(itemData); |
| | | itemCells[i].button.SetListener(() =>
|
| | | { |
| | | ItemTipUtility.Show((int)award.ItemID); |
| | | });
|
| | |
|
| | | freeGrays[i].SetActive(state == 2 || state == 4 || state == 5); |
| | | freeLocks[i].SetActive(false); |
| | | freeHaves[i].SetActive(state == 2 || state == 4 || state == 5); |
| | | } |
| | | else |
| | | { |
| | | itemCells[i].SetActive(false); |
| | | freeGrays[i].SetActive(false); |
| | | freeLocks[i].SetActive(false);
|
| | | freeHaves[i].SetActive(false); |
| | | } |
| | | } |
| | | bool isBuy = model.IsBuyAwardEx(); |
| | | var awardExs = holiday.loginAwards[index].AwardItemListEx; |
| | | for (int i = 0; i < itemCellExs.Count; i++) |
| | | { |
| | | if (i < awardExs.Length) |
| | | { |
| | | var awardEx = awardExs[i]; |
| | | itemCellExs[i].SetActive(true); |
| | | var itemData = new ItemCellModel((int)awardEx.ItemID, false, awardEx.ItemCount); |
| | | itemCellExs[i].Init(itemData); |
| | | itemCellExs[i].button.SetListener(() =>
|
| | | { |
| | | ItemTipUtility.Show((int)awardEx.ItemID); |
| | | }); |
| | | if (isBuy)
|
| | | {
|
| | | //paidGrays[i].SetActive(state == 0 || state == 2 || state == 5);
|
| | | //paidLocks[i].SetActive(state == 0 || state == 5);
|
| | | //paidHaves[i].SetActive(state == 2);
|
| | | paidGrays[i].SetActive(state == 2);
|
| | | paidLocks[i].SetActive(false);
|
| | | paidHaves[i].SetActive(state == 2);
|
| | | }
|
| | | else
|
| | | {
|
| | | paidGrays[i].SetActive(true);
|
| | | paidLocks[i].SetActive(true);
|
| | | paidHaves[i].SetActive(false);
|
| | | }
|
| | | } |
| | | else |
| | | { |
| | | itemCellExs[i].SetActive(false); |
| | | paidGrays[i].SetActive(false);
|
| | | paidLocks[i].SetActive(false);
|
| | | paidHaves[i].SetActive(false); |
| | | } |
| | | }
|
| | | } |
| | | }
|
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 612249fb26f771b49b1128ba77e97ac2 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System;
|
| | |
|
| | | namespace vnxbqy.UI |
| | | { |
| | | public class FairyAffinityLoginActModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity |
| | | { |
| | | public event Action<int> onStateUpdate; |
| | | public Redpoint redPoint = new Redpoint(MainRedDot.FairyAffinityRepoint, MainRedDot.FairyAffinityRepoint * 10 + 2); //可能挂多个父红点 |
| | | public int buyValue; |
| | | |
| | | private uint LoginAwardState; //领取状态 可以补签 |
| | | private uint LoginAwardExState; // 额外奖励领取记录 可以补签 |
| | | |
| | | public const int activityType = (int)OpenServerActivityCenter.ActivityType.AT_Activity2; |
| | | public const int activityID = (int)NewDayActivityID.FairyAffinityLoginAct; |
| | | public static Operation operaType = Operation.default44; |
| | | |
| | | public int actNum = 11; //对应界面 |
| | | public event Action UpdateyLoginEvent;
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
| | |
|
| | | public override void Init() |
| | | { |
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent; |
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent; |
| | | OperationTimeHepler.Instance.operationAdvanceEvent += OperationAdvanceEvent; |
| | | OpenServerActivityCenter.Instance.Register(activityID, this, activityType); |
| | | vipModel.rechargeCountEvent += VipModel_rechargeCountEvent; |
| | | buyValue = int.Parse(FuncConfigConfig.Get("FairyAffinity").Numerical2); |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | } |
| | | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | } |
| | | |
| | | public override void UnInit() |
| | | {
|
| | | vipModel.rechargeCountEvent -= VipModel_rechargeCountEvent;
|
| | | }
|
| | |
|
| | | private void VipModel_rechargeCountEvent(int obj)
|
| | | {
|
| | | if (IsOpen)
|
| | | {
|
| | | UpdateRedpoint();
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsOpen
|
| | | { |
| | | get
|
| | | { |
| | | return OperationTimeHepler.Instance.SatisfyOpenCondition(operaType); |
| | | } |
| | | } |
| | | |
| | | public bool priorityOpen
|
| | | { |
| | | get
|
| | | { |
| | | return redPoint.state == RedPointState.Simple; |
| | | } |
| | | } |
| | | |
| | | public bool IsAdvance
|
| | | { |
| | | get
|
| | | { |
| | | return OperationTimeHepler.Instance.SatisfyAdvanceCondition(operaType); |
| | | } |
| | | } |
| | | |
| | | private void OperationEndEvent(Operation type, int state) |
| | | { |
| | | if (type == operaType && state == 0) |
| | | { |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | UpdateRedpoint(); |
| | | } |
| | | } |
| | | |
| | | private void OperationAdvanceEvent(Operation type) |
| | | { |
| | | if (type == operaType) |
| | | { |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void OperationStartEvent(Operation type, int state) |
| | | { |
| | | if (type == operaType && state == 0) |
| | | {
|
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public bool IsBuyAwardEx()
|
| | | {
|
| | | OperationLoginAct holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out holiday);
|
| | | if (holiday == null)
|
| | | return false;
|
| | | if (holiday.awardExCTGID <= 0)
|
| | | return false;
|
| | |
|
| | | VipModel.RechargeCount rechargeCount;
|
| | | vipModel.TryGetRechargeCount(holiday.awardExCTGID, out rechargeCount);
|
| | | var ctgConfig = CTGConfig.Get(holiday.awardExCTGID);
|
| | | int buyCnt = rechargeCount.totalCount;
|
| | | int totalCnt = ctgConfig.TotalBuyCount;
|
| | | return totalCnt <= buyCnt;
|
| | | } |
| | | |
| | | public int GetHaveAwardDayCnt()
|
| | | {
|
| | | OperationLoginAct holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out holiday);
|
| | | if (holiday == null)
|
| | | return 0;
|
| | | int num = 0;
|
| | | for (int i = 0; i < holiday.loginAwards.Count; i++) |
| | | { |
| | | //0 不可领取(日期未到) 1 可领取 2 已领取 3补签(已过天) 4 继续签到(已购买) 5 继续签到(未购买) |
| | | var state = GetLoginAwardState(i + 1); |
| | | if (state == 2 || state == 4 || state == 5)
|
| | | num += 1; |
| | | }
|
| | | return num;
|
| | | } |
| | | |
| | | //0 不可领取(日期未到) 1 可领取 2 已领取 3补签(已过天) 4 继续签到(已购买) 5 继续签到(未购买) |
| | | //day 从1开始 |
| | | public int GetLoginAwardState(int day) |
| | | {
|
| | | //校验日期
|
| | | OperationLoginAct holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out holiday); |
| | | if (holiday == null) return 0; |
| | | |
| | | int days = holiday.IndexOfDays(TimeUtility.ServerNow); //当前是第几天 |
| | | if (days == -1) return 0; |
| | | if (day > days + 1) return 0; |
| | | if (!IsBuyAwardEx())
|
| | | {
|
| | | if (((int)Math.Pow(2, day) & LoginAwardState) == 0)
|
| | | {
|
| | | return day != days + 1 ? 3 : 1;
|
| | | }
|
| | | else
|
| | | {
|
| | | return 5;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (((int)Math.Pow(2, day) & LoginAwardState) == 0)
|
| | | {
|
| | | return day != days + 1 ? 3 : 1;
|
| | | }
|
| | | else
|
| | | {
|
| | | return ((int)Math.Pow(2, day) & LoginAwardExState) == 0 ? 4 : 2;
|
| | | }
|
| | | } |
| | | }
|
| | | |
| | | private void UpdateRedpoint() |
| | | { |
| | | redPoint.state = RedPointState.None; |
| | | if (!IsOpen) return; |
| | | OperationLoginAct holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out holiday); |
| | | if (holiday == null) return; //封包顺序如果有问题 此处为空 |
| | | |
| | | for (int i = 0; i < holiday.loginAwards.Count; i++) |
| | | { |
| | | //0 不可领取(日期未到) 1 可领取 2 已领取 3补签(已过天) 4 继续签到(已购买) 5 继续签到(未购买) |
| | | if (GetLoginAwardState(holiday.loginAwards[i].DayNum) == 1 || GetLoginAwardState(holiday.loginAwards[i].DayNum) == 4) |
| | | { |
| | | redPoint.state = RedPointState.Simple; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void UpdateLoginInfo(HAA70_tagMCActLoginPlayerInfoNew netPack) |
| | | {
|
| | | if (actNum != netPack.ActNum)
|
| | | return; |
| | | LoginAwardState = netPack.LoginAward; |
| | | LoginAwardExState = netPack.LoginAwardEx; |
| | | UpdateyLoginEvent?.Invoke(); |
| | | |
| | | UpdateRedpoint(); |
| | | } |
| | | |
| | | public void SendGetAward(int day) |
| | | { |
| | | CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward(); |
| | | getReward.RewardType = 70; |
| | | getReward.DataEx = (uint)day; |
| | | getReward.DataExStr = actNum.ToString(); |
| | | getReward.DataExStrLen = (byte)getReward.DataExStr.Length; |
| | | GameNetSystem.Instance.SendInfo(getReward); |
| | | }
|
| | | |
| | | public void SendGetAwardEx(int day) |
| | | { |
| | | CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward(); |
| | | getReward.RewardType = 70; |
| | | getReward.DataEx = 1000 + (uint)day; |
| | | getReward.DataExStr = actNum.ToString(); |
| | | getReward.DataExStrLen = (byte)getReward.DataExStr.Length; |
| | | GameNetSystem.Instance.SendInfo(getReward); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 999dfc63ee14d2142955f75852d9b9b8 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Thursday, April 18, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System; |
| | | using UnityEngine; |
| | | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | public class FairyAffinityLoginActWin : Window |
| | | {
|
| | | [SerializeField] TextEx txtProfitRatio;
|
| | | [SerializeField] TextEx txtBuyValue;
|
| | | [SerializeField] TextEx txtBuy;
|
| | | [SerializeField] ButtonEx btnBuy;
|
| | | [SerializeField] ImageEx imgBuy; |
| | | [SerializeField] ScrollerController m_Controller;
|
| | | // 登录天
|
| | | //[SerializeField] Text actTime;
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } } |
| | | FairyAffinityLoginActModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityLoginActModel>(); } }
|
| | |
|
| | | #region Built-in |
| | |
|
| | | protected override void BindController() |
| | | {
|
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | {
|
| | | btnBuy.SetListener(() =>
|
| | | {
|
| | | OperationLoginAct holiday;
|
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityLoginActModel.operaType, out holiday);
|
| | | if (holiday == null)
|
| | | return;
|
| | | bool isBuy = model.IsBuyAwardEx();
|
| | | if (isBuy)
|
| | | return;
|
| | | vipModel.CTG(holiday.awardExCTGID);
|
| | | });
|
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | m_Controller.OnRefreshCell += OnRefreshCell; |
| | | model.UpdateyLoginEvent += UpdateHolidayLogin; |
| | | GlobalTimeEvent.Instance.secondEvent += secondEvent; |
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent += OnOperationTimeUpdateEvent; |
| | | vipModel.rechargeCountEvent += VipModel_rechargeCountEvent; |
| | | Display(); |
| | | DisplayScroll(); |
| | | secondEvent(); |
| | | }
|
| | |
|
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | m_Controller.OnRefreshCell -= OnRefreshCell; |
| | | model.UpdateyLoginEvent -= UpdateHolidayLogin; |
| | | GlobalTimeEvent.Instance.secondEvent -= secondEvent; |
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent -= OnOperationTimeUpdateEvent; |
| | | vipModel.rechargeCountEvent -= VipModel_rechargeCountEvent; |
| | | }
|
| | |
|
| | | private void VipModel_rechargeCountEvent(int obj)
|
| | | {
|
| | | m_Controller.m_Scorller.RefreshActiveCellViews();
|
| | | Display();
|
| | | }
|
| | |
|
| | | private void OnOperationTimeUpdateEvent(Operation operation)
|
| | | {
|
| | | if (operation == Operation.default44)
|
| | | {
|
| | | m_Controller.m_Scorller.RefreshActiveCellViews();
|
| | | Display();
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose() |
| | | { |
| | | }
|
| | | |
| | | #endregion |
| | | |
| | | private void Display()
|
| | | {
|
| | | bool isBuy = model.IsBuyAwardEx();
|
| | | btnBuy.SetActiveIL(!isBuy);
|
| | | imgBuy.SetActiveIL(isBuy);
|
| | | OperationLoginAct holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityLoginActModel.operaType, out holiday);
|
| | | if (holiday == null || holiday.awardExCTGID <= 0)
|
| | | return;
|
| | | OrderInfoConfig orderCfg;
|
| | | vipModel.TryGetOrderInfo(holiday.awardExCTGID, out orderCfg);
|
| | | txtBuy.text = Language.Get("PayMoneyNum", orderCfg.PayRMBNum);
|
| | | txtProfitRatio.text = Language.Get("BlessedLand039", CTGConfig.Get(holiday.awardExCTGID).Percentage);
|
| | | txtBuyValue.text = model.buyValue.ToString();
|
| | | } |
| | | |
| | | private void DisplayScroll() |
| | | { |
| | | m_Controller.Refresh(); |
| | | OperationLoginAct holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityLoginActModel.operaType, 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(GetDefaultSelect()); |
| | | } |
| | | |
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | if (type != ScrollerDataType.Header) return; |
| | | |
| | | var _cell = cell as FairyAffinityLoginActCell;
|
| | |
|
| | | _cell.Display(_cell.index);
|
| | | } |
| | | |
| | | private void UpdateHolidayLogin() |
| | | { |
| | | m_Controller.m_Scorller.RefreshActiveCellViews(); |
| | | Display(); |
| | | }
|
| | |
|
| | | //优先选择可领取的,然后是已领取的下一天
|
| | | private int GetDefaultSelect() |
| | | { |
| | | OperationLoginAct holiday; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityLoginActModel.operaType, out holiday); |
| | | |
| | | int getYet = -1; |
| | | int reSign = -1; |
| | | for (int i = 0; i < holiday.loginAwards.Count; i++) |
| | | { |
| | | //0 不可领取(日期未到) 1 可领取 2 已领取 3补签(已过天) 4 继续签到(已购买) 5 继续签到(未购买) |
| | | var state = model.GetLoginAwardState(i + 1); |
| | | if (state == 1 || state == 4) |
| | | return i; |
| | | if (state == 2) |
| | | getYet = i; |
| | | if (state == 3 && reSign == -1) |
| | | reSign = i; |
| | | } |
| | | if (reSign != -1) |
| | | return reSign; |
| | | return getYet;
|
| | | }
|
| | |
|
| | | private void secondEvent() |
| | | {
|
| | | //OperationLoginAct holiday; |
| | | //OperationTimeHepler.Instance.TryGetOperation(FairyAffinityLoginActModel.operaType, out holiday); |
| | | //actTime.text = Language.Get("BossFHLanguage2", TimeUtility.SecondsToHMS(holiday.GetResetSurplusTime())); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 21e3a1264bdc5d642aeedcf43b12b2f8 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, September 26, 2018 |
| | | //-------------------------------------------------------- |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class FairyAffinityMissionActCell : CellView
|
| | | { |
| | | [SerializeField] Text missionText; |
| | | [SerializeField] List<ItemCell> itemCells; |
| | | [SerializeField] Button getGiftBtn; |
| | | [SerializeField] Image gotYetImg; |
| | | [SerializeField] Button goBtn; |
| | | |
| | | FairyAffinityMissionActModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityMissionActModel>(); } }
|
| | |
|
| | | public void Display(int id) |
| | | { |
| | | OperationMissionAct missionAct; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityMissionActModel.operaType, out missionAct); |
| | | var mission = missionAct.missionInfo[id]; |
| | | missionText.text = Language.Get("MissionActType_" + mission.TaskType, Math.Min(model.missionValueDict[mission.TaskType], mission.NeedValue), mission.NeedValue); |
| | | var awards = mission.AwardItemList; |
| | | for (int i = 0; i < itemCells.Count; i++) |
| | | { |
| | | if (i < awards.Length) |
| | | { |
| | | var award = awards[i]; |
| | | itemCells[i].SetActive(true); |
| | | var itemData = new ItemCellModel((int)award.ItemID, false, award.ItemCount); |
| | | itemCells[i].Init(itemData); |
| | | itemCells[i].button.SetListener(() =>
|
| | | { |
| | | ItemTipUtility.Show((int)award.ItemID); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | itemCells[i].SetActive(false); |
| | | } |
| | | } |
| | | var state = model.GetMissionAwardState(id); |
| | | goBtn.SetActive(state == 0); |
| | | goBtn.SetListener(() =>
|
| | | {
|
| | | WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)model.missionJumpIDs[mission.TaskType]);
|
| | | }); |
| | | getGiftBtn.SetActive(state == 1); |
| | | getGiftBtn.SetListener(() =>
|
| | | { |
| | | GetAllAward(); |
| | | }); |
| | | gotYetImg.SetActive(state == 2);
|
| | | } |
| | | |
| | | //一键领取并且 提前展示奖励 |
| | | private void GetAllAward()
|
| | | {
|
| | | List<Item> items = new List<Item>();
|
| | | OperationMissionAct missionAct; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityMissionActModel.operaType, out missionAct);
|
| | |
|
| | | var keys = missionAct.missionInfo.Keys.ToList(); |
| | | foreach (var id in keys) |
| | | {
|
| | | var state = model.GetMissionAwardState(id);
|
| | | if (state == 1)
|
| | | {
|
| | | model.SendGetAward(id);
|
| | | var mission = missionAct.missionInfo[id];
|
| | | foreach (var item in mission.AwardItemList)
|
| | | {
|
| | | items.Add(new Item((int)item.ItemID, item.ItemCount));
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | ItemLogicUtility.Instance.ShowGetItem(items, "", 0); |
| | | } |
| | | }
|
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 5b93bfa1076078f4faa57a4c483c19c6 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using LitJson; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace vnxbqy.UI |
| | | { |
| | | public class FairyAffinityMissionActModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity |
| | | { |
| | | public event Action<int> onStateUpdate; |
| | | public Redpoint redPoint = new Redpoint(MainRedDot.FairyAffinityRepoint, MainRedDot.FairyAffinityRepoint * 10 + 3); //可能挂多个父红点 |
| | | |
| | | private uint[] AwardRecordList; //领取状态 |
| | | public int roundNum { get; private set; } //当前轮次 从1开始 |
| | | public Dictionary<int, int> missionValueDict = new Dictionary<int, int>(); //类型:任务进度 |
| | | |
| | | public const int activityType = (int)OpenServerActivityCenter.ActivityType.AT_Activity2; |
| | | public const int activityID = (int)NewDayActivityID.FairyAffinityMissionAct; |
| | | public static Operation operaType = Operation.default45; |
| | | |
| | | public int actNum = 11; //对应界面 |
| | | public event Action<bool> UpdateMissionEvent;
|
| | | public Dictionary<int, int> missionJumpIDs = new Dictionary<int, int>(); |
| | | |
| | | public override void Init() |
| | | { |
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent; |
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent; |
| | | OperationTimeHepler.Instance.operationAdvanceEvent += OperationAdvanceEvent; |
| | | OpenServerActivityCenter.Instance.Register(activityID, this, activityType); |
| | | |
| | | var json = JsonMapper.ToObject(FuncConfigConfig.Get("MissionAction").Numerical1); |
| | | var keys = json.Keys.ToList(); |
| | | for (int i = 0; i < keys.Count; i++) |
| | | {
|
| | | missionJumpIDs.Add(int.Parse(keys[i]), int.Parse(json[keys[i]].ToString()));
|
| | | } |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | missionValueDict.Clear(); |
| | | roundNum = 0; |
| | | AwardRecordList = new uint[0]; |
| | | } |
| | | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | } |
| | | |
| | | public override void UnInit() |
| | | {
|
| | | } |
| | | |
| | | public bool IsOpen
|
| | | { |
| | | get
|
| | | { |
| | | return OperationTimeHepler.Instance.SatisfyOpenCondition(operaType); |
| | | } |
| | | } |
| | | |
| | | public bool priorityOpen
|
| | | { |
| | | get
|
| | | { |
| | | return redPoint.state == RedPointState.Simple; |
| | | } |
| | | } |
| | | |
| | | public bool IsAdvance
|
| | | { |
| | | get
|
| | | { |
| | | return OperationTimeHepler.Instance.SatisfyAdvanceCondition(operaType); |
| | | } |
| | | } |
| | | |
| | | private void OperationEndEvent(Operation type, int state) |
| | | { |
| | | if (type == operaType && state == 0) |
| | | { |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | UpdateRedpoint(); |
| | | } |
| | | } |
| | | |
| | | private void OperationAdvanceEvent(Operation type) |
| | | { |
| | | if (type == operaType) |
| | | { |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void OperationStartEvent(Operation type, int state) |
| | | { |
| | | if (type == operaType && state == 0) |
| | | {
|
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 获取当前完成任务的数量 |
| | | public int GetTaskOkCnt()
|
| | | {
|
| | | OperationMissionAct missionAct; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out missionAct); |
| | | if (missionAct == null)
|
| | | return 0; //封包顺序如果有问题 此处为空 |
| | | |
| | | int num = 0; |
| | | var keys = missionAct.missionInfo.Keys.ToList(); |
| | | for (int i = 0; i < keys.Count; i++) |
| | | { |
| | | if (GetMissionAwardState(keys[i]) == 1 || GetMissionAwardState(keys[i]) == 2) |
| | | num += 1; |
| | | }
|
| | | return num;
|
| | | }
|
| | |
|
| | | // 获取当前任务的总数量
|
| | | public int GetTaskAllCnt()
|
| | | {
|
| | | OperationMissionAct missionAct; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out missionAct);
|
| | | return missionAct == null ? 0 : missionAct.missionInfo.Keys.Count;
|
| | | }
|
| | |
|
| | | //0 不可领取 1 可领取 2 已领取 |
| | | public int GetMissionAwardState(int id) |
| | | {
|
| | | if (AwardRecordList.IsNullOrEmpty()) return 0;
|
| | | OperationMissionAct missionAct; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out missionAct); |
| | | if (missionAct == null) return 0;
|
| | |
|
| | | if (!missionAct.missionInfo.ContainsKey(id)) return 0;
|
| | |
|
| | | var mission = missionAct.missionInfo[id];
|
| | |
|
| | | if (!missionValueDict.ContainsKey(mission.TaskType)) return 0;
|
| | |
|
| | | if (missionValueDict[mission.TaskType] < mission.NeedValue)
|
| | | {
|
| | | return 0;
|
| | | }
|
| | |
|
| | | var listIndex = id / 31;
|
| | | var bitIndex = id % 31;
|
| | | if (listIndex >= AwardRecordList.Length)
|
| | | {
|
| | | //超过服务端下发的长度 认为未领取
|
| | | return 1;
|
| | | }
|
| | |
|
| | | if (((int)Math.Pow(2, bitIndex) & (int)AwardRecordList[listIndex]) == 0)
|
| | | {
|
| | | return 1;
|
| | | } |
| | | return 2; |
| | | } |
| | | |
| | | private void UpdateRedpoint() |
| | | { |
| | | redPoint.state = RedPointState.None; |
| | | if (!IsOpen) return; |
| | | OperationMissionAct missionAct; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out missionAct); |
| | | if (missionAct == null) return; //封包顺序如果有问题 此处为空 |
| | | |
| | | var keys = missionAct.missionInfo.Keys.ToList(); |
| | | for (int i = 0; i < keys.Count; i++) |
| | | { |
| | | if (GetMissionAwardState(keys[i]) == 1) |
| | | { |
| | | redPoint.state = RedPointState.Simple; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void UpdateMissionPlayerInfo(HAA73_tagMCActTaskPlayerInfo netPack) |
| | | { |
| | | if (netPack.ActNum != actNum)
|
| | | return; |
| | | AwardRecordList = netPack.AwardRecordList; |
| | | bool isNewRound = false; |
| | | if (roundNum != netPack.RoundNum)
|
| | | {
|
| | | roundNum = netPack.RoundNum; |
| | | isNewRound = true; |
| | | } |
| | | UpdateMissionEvent?.Invoke(isNewRound); |
| | | |
| | | UpdateRedpoint(); |
| | | } |
| | | |
| | | public void UpdateMissionPlayerValueInfo(HAA72_tagMCActTaskPlayerValueInfo netPack)
|
| | | { |
| | | if (netPack.ActNum != actNum)
|
| | | return; |
| | | for (int i = 0; i < netPack.TaskValueList.Length; i++) |
| | | {
|
| | | missionValueDict[netPack.TaskValueList[i].TaskType] = (int)netPack.TaskValueList[i].TaskValue;
|
| | | }
|
| | |
|
| | | UpdateMissionEvent?.Invoke(false); |
| | | |
| | | UpdateRedpoint(); |
| | | } |
| | | |
| | | public void SendGetAward(int id) |
| | | { |
| | | CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward(); |
| | | getReward.RewardType = 71; |
| | | getReward.DataEx = (uint)id; |
| | | getReward.DataExStr = actNum.ToString(); |
| | | getReward.DataExStrLen = (byte)getReward.DataExStr.Length; |
| | | GameNetSystem.Instance.SendInfo(getReward); |
| | | }
|
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: cc32bebaf0264f34a92174abae746fea |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Thursday, April 18, 2019 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | public class FairyAffinityMissionActWin : Window |
| | | { |
| | | [SerializeField] ScrollerController m_Controller;
|
| | | [SerializeField] Text actTime; |
| | | [SerializeField] Text txtFinishedTaskCount; |
| | | //[SerializeField] Text roundText;
|
| | |
|
| | | [SerializeField] TextEx txtBuy;
|
| | | [SerializeField] TextEx txtProfitRatio;
|
| | | [SerializeField] TextEx txtBuyValue;
|
| | | [SerializeField] ButtonEx btnBuy;
|
| | | [SerializeField] ImageEx imgBuy; |
| | | FairyAffinityMissionActModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityMissionActModel>(); } } |
| | | FairyAffinityZhanLingModel fairyAffinityZhanLingModel { get { return ModelCenter.Instance.GetModel<FairyAffinityZhanLingModel>(); } }
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
| | |
|
| | | #region Built-in |
| | |
|
| | | protected override void BindController() |
| | | {
|
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | {
|
| | | btnBuy.SetListener(() =>
|
| | | {
|
| | | vipModel.CTG(fairyAffinityZhanLingModel.ctgIdDict[fairyAffinityZhanLingModel.ZhanLingType]);
|
| | | });
|
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | m_Controller.OnRefreshCell += OnRefreshCell; |
| | | model.UpdateMissionEvent += UpdateMissionEvent; |
| | | GlobalTimeEvent.Instance.secondEvent += secondEvent; |
| | | Display(); |
| | | DisplayScroll(); |
| | | secondEvent();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | m_Controller.OnRefreshCell -= OnRefreshCell; |
| | | model.UpdateMissionEvent -= UpdateMissionEvent; |
| | | GlobalTimeEvent.Instance.secondEvent -= secondEvent; |
| | | PlayerDatas.Instance.playerDataRefreshEvent += OnplayerDataRefreshEvent;
|
| | | fairyAffinityZhanLingModel.UpdateGiftStateEvent += UpdateGiftStateEvent; |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | }
|
| | | |
| | | #endregion |
| | |
|
| | | private void OnplayerDataRefreshEvent(PlayerDataType type)
|
| | | {
|
| | | if (type == PlayerDataType.default42)
|
| | | {
|
| | | if (fairyAffinityZhanLingModel.zhanLingInfoDict == null || !fairyAffinityZhanLingModel.zhanLingInfoDict.ContainsKey(fairyAffinityZhanLingModel.ZhanLingType))
|
| | | return;
|
| | | Display();
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateGiftStateEvent()
|
| | | {
|
| | | bool isBuyZhanLing = fairyAffinityZhanLingModel.IsBuy();
|
| | | btnBuy.SetActiveIL(!isBuyZhanLing);
|
| | | imgBuy.SetActiveIL(isBuyZhanLing);
|
| | | Display();
|
| | | } |
| | | |
| | | private void Display()
|
| | | {
|
| | | bool isBuyZhanLing = fairyAffinityZhanLingModel.IsBuy();
|
| | | btnBuy.SetActiveIL(!isBuyZhanLing);
|
| | | imgBuy.SetActiveIL(isBuyZhanLing);
|
| | | OrderInfoConfig orderCfg;
|
| | | vipModel.TryGetOrderInfo(fairyAffinityZhanLingModel.ctgIdDict[fairyAffinityZhanLingModel.ZhanLingType], out orderCfg);
|
| | | txtBuy.text = Language.Get("PayMoneyNum", orderCfg.PayRMBNum);
|
| | | txtProfitRatio.text = Language.Get("BlessedLand039", CTGConfig.Get(fairyAffinityZhanLingModel.ctgIdDict[fairyAffinityZhanLingModel.ZhanLingType]).Percentage);
|
| | | txtBuyValue.text = fairyAffinityZhanLingModel.buyValue.ToString();
|
| | |
|
| | | txtFinishedTaskCount.text = Language.Get("FairyAffinity08", model.GetTaskOkCnt(), model.GetTaskAllCnt());
|
| | | } |
| | | |
| | | private void DisplayScroll() |
| | | { |
| | | m_Controller.Refresh(); |
| | | OperationMissionAct missionAct; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityMissionActModel.operaType, out missionAct); |
| | | |
| | | var keys = missionAct.missionInfo.Keys.ToList(); |
| | | keys.Sort(CmpState); |
| | | for (int i = 0; i < keys.Count; i++) |
| | | { |
| | | m_Controller.AddCell(ScrollerDataType.Header, keys[i]); |
| | | } |
| | | m_Controller.Restart(); |
| | | m_Controller.m_Scorller.RefreshActiveCellViews(); |
| | | |
| | | //roundText.text = StringUtility.Contact(Language.Get("ActMission1"), model.roundNum, "/", missionAct.roundMax); |
| | | }
|
| | |
|
| | | //可领取 - 未完成 - 已领取 |
| | | private int CmpState(int id1, int id2)
|
| | | { |
| | | int state1 = model.GetMissionAwardState(id1);
|
| | | int state2 = model.GetMissionAwardState(id2);
|
| | | if (state1 == 1)
|
| | | state1 = 0;
|
| | | else if (state1 == 0)
|
| | | state1 = 1;
|
| | | if (state2 == 1)
|
| | | state2 = 0;
|
| | | else if (state2 == 0)
|
| | | state2 = 1;
|
| | |
|
| | | if (state1 != state2)
|
| | | return state1.CompareTo(state2);
|
| | |
|
| | | return id1.CompareTo(id2); |
| | | }
|
| | |
|
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | if (type != ScrollerDataType.Header) return; |
| | | |
| | | var _cell = cell as FairyAffinityMissionActCell;
|
| | |
|
| | | _cell.Display(_cell.index);
|
| | | } |
| | | |
| | | private void UpdateMissionEvent(bool isNewRound) |
| | | {
|
| | | OperationMissionAct missionAct; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityMissionActModel.operaType, out missionAct); |
| | | |
| | | if (isNewRound)
|
| | | {
|
| | | DisplayScroll();
|
| | | } |
| | | else
|
| | | {
|
| | | m_Controller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | Display(); |
| | | //roundText.text = StringUtility.Contact(Language.Get("ActMission1"), model.roundNum, "/", missionAct.roundMax); |
| | | }
|
| | |
|
| | | private void secondEvent() |
| | | {
|
| | | OperationMissionAct missionAct; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityMissionActModel.operaType, out missionAct); |
| | | actTime.text = Language.Get("FairyAffinity09", TimeUtility.SecondsToDHMSCHS(missionAct.GetResetSurplusTime())); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c19f933bb9432864896c63917b71293b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | public class FairyAffinityModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
| | | {
|
| | | // 1 仙缘 2 福禄 3 任务 4 礼包
|
| | | public int funcOrder = 0;
|
| | |
|
| | | public Redpoint redPoint = new Redpoint(MainRedDot.FairyAffinityRepoint);
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | funcOrder = 0;
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | }
|
| | | }
|
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: de93323b7e0352c4690b690ec38dd385 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, September 26, 2018 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class FairyAffinityRechargeGiftActCell : CellView
|
| | | { |
| | | [SerializeField] Text title; |
| | | [SerializeField] ImageEx bg; |
| | | [SerializeField] ImageEx titleBG; |
| | | [SerializeField] List<CustomizedItemCell> itemCells; |
| | | [SerializeField] Button buyBtn; |
| | | [SerializeField] Text priceText; |
| | | [SerializeField] Image buyYetImg;
|
| | | [SerializeField] Image imgProfitRatio;
|
| | | [SerializeField] Text txtProfitRatio;
|
| | |
|
| | | FairyAffinityRechargeGiftActModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityRechargeGiftActModel>(); } }
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } } |
| | | |
| | | BossTrialModel bossTrialModel { get { return ModelCenter.Instance.GetModel<BossTrialModel>(); } }
|
| | | StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
|
| | | CustomizedRechargeModel customizedRechargeModel { get { return ModelCenter.Instance.GetModel<CustomizedRechargeModel>(); } }
|
| | |
|
| | | public void Display(int index) |
| | | { |
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityRechargeGiftActModel.operaType, out act);
|
| | | bg.SetSprite(index % 2 == 0 ? "FairyAffinityGiftBG1" : "FairyAffinityGiftBG2");
|
| | | titleBG.SetSprite(index % 2 == 0 ? "FairyAffinityGiftTitleBG1" : "FairyAffinityGiftTitleBG2");
|
| | |
|
| | | List<StoreConfig> _list = null; |
| | | StoreConfig.TryGetStoreConfigs(act.shopType, out _list); |
| | | |
| | | if (_list != null && index < _list.Count)
|
| | | {
|
| | | DisplayStore(_list[index]);
|
| | | return;
|
| | | } |
| | | index = index - (_list != null ? _list.Count : 0);
|
| | |
|
| | | int ctgID = act.ctgIDs[index]; |
| | | var ctgConfig = CTGConfig.Get(ctgID);
|
| | | title.text = ctgConfig.Title;
|
| | |
|
| | | var countInfo = model.GetBuyCntInfo(ctgID);
|
| | |
|
| | | int buyCnt = countInfo.x;
|
| | | int totalCnt = countInfo.y;
|
| | |
|
| | | customizedRechargeModel.ShowUIItems(itemCells, ctgID);
|
| | |
|
| | | buyBtn.SetActive(buyCnt < totalCnt); |
| | | buyBtn.SetListener(() =>
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.VIPLv < ctgConfig.VipLevel)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("VIPNotEnough", ctgConfig.VipLevel);
|
| | | return;
|
| | | }
|
| | |
|
| | | if (bossTrialModel.IsOpen)
|
| | | {
|
| | | //参与时间结束前直接购买,时间结束后再购买需要弹窗提示
|
| | | if (bossTrialModel.IsPrepareTime || bossTrialModel.IsJoin)
|
| | | vipModel.CTG(ctgID);
|
| | | else
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("BossTrial14"), (bool isOk) =>
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | vipModel.CTG(ctgID);
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | vipModel.CTG(ctgID);
|
| | | }
|
| | | }); |
| | | buyYetImg.SetActive(buyCnt >= totalCnt); |
| | | |
| | | OrderInfoConfig orderConfig; |
| | | vipModel.TryGetOrderInfo(ctgID, out orderConfig); |
| | | imgProfitRatio.SetActive(orderConfig != null); |
| | | priceText.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(orderConfig.PayRMBNum)); |
| | | txtProfitRatio.text = Language.Get("BlessedLand039", ctgConfig.Percentage); |
| | | } |
| | | |
| | | private void DisplayStore(StoreConfig storeConfig)
|
| | | {
|
| | | bool isFree = storeConfig.MoneyNumber == 0; |
| | | title.text = isFree ? Language.Get("StoreName_free") : Language.Get("StoreName_money"); |
| | | |
| | | int remainNum; |
| | | storeModel.TryGetIsSellOut(storeConfig, out remainNum);
|
| | |
|
| | | var items = storeModel.GetShopItemlistByIndex(storeConfig); |
| | | |
| | | for (int i = 0; i < itemCells.Count; i++)
|
| | | {
|
| | | var itemBaisc = itemCells[i];
|
| | | if (i < items.Count)
|
| | | {
|
| | | var itemInfo = items[i];
|
| | | itemBaisc.SetActive(true);
|
| | | ItemCellModel cellModel = new ItemCellModel(itemInfo.itemId, false, (ulong)itemInfo.count);
|
| | | itemBaisc.Init(cellModel);
|
| | | itemBaisc.button.AddListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemInfo.itemId);
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | itemBaisc.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | buyBtn.SetActive(remainNum > 0); |
| | | buyBtn.SetListener(() =>
|
| | | {
|
| | | storeModel.SendBuyShopItemWithPopCheck(storeConfig, 1, (int)BuyStoreItemCheckType.ActGift);
|
| | | }); |
| | | buyYetImg.SetActive(remainNum <= 0); |
| | | |
| | | priceText.text = isFree ? Language.Get("AloneFree") : Language.Get("ItemOverdue105", storeConfig.MoneyNumber); |
| | | imgProfitRatio.SetActive(false); |
| | | //txtProfitRatio.text = Language.Get("BlessedLand039", ctgConfig.Percentage); |
| | | } |
| | | }
|
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d2e25624648fd3347a57c240e75f9e1e |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic;
|
| | |
|
| | | namespace vnxbqy.UI |
| | | { |
| | | //同样是日期型礼包活动,充值内容不同,普通的充值礼包 + 累计充值次数奖励 |
| | | public class FairyAffinityRechargeGiftActModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity |
| | | { |
| | | //同步播放摆动动画
|
| | | public Action PlayAnimationSync;
|
| | |
|
| | | private bool isPlayAnimation = false;
|
| | | public bool IsPlayAnimation
|
| | | {
|
| | | get
|
| | | {
|
| | | return isPlayAnimation;
|
| | | }
|
| | | set
|
| | | {
|
| | | isPlayAnimation = value;
|
| | | if (isPlayAnimation)
|
| | | {
|
| | | PlayAnimationSync?.Invoke();
|
| | | }
|
| | | isPlayAnimation = false;
|
| | | }
|
| | | } |
| | | |
| | | public event Action<int> onStateUpdate; |
| | | public Redpoint redPoint = new Redpoint(MainRedDot.FairyAffinityRepoint, MainRedDot.FairyAffinityRepoint * 10 + 4); //可能挂多个父红点 |
| | | public int getGiftCount;//仙缘礼包购买x次可获得积福奖励 |
| | | |
| | | private int GiftAwardRecord; //领取状态 |
| | | |
| | | public const int activityType = (int)OpenServerActivityCenter.ActivityType.AT_Activity2; |
| | | public const int activityID = (int)NewDayActivityID.FairyAffinityRechargeGiftAct; |
| | | public static Operation operaType = Operation.default46; |
| | | |
| | | public const int actNum = 11; //对应界面 |
| | | public event Action UpdateRechargeGiftActEvent;
|
| | |
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } } |
| | | StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } |
| | | |
| | | public override void Init() |
| | | { |
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent; |
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent; |
| | | OperationTimeHepler.Instance.operationAdvanceEvent += OperationAdvanceEvent; |
| | | storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent; |
| | | vipModel.rechargeCountEvent += VipModel_rechargeCountEvent; |
| | | OpenServerActivityCenter.Instance.Register(activityID, this, activityType); |
| | | getGiftCount = int.Parse(FuncConfigConfig.Get("FairyAffinity").Numerical3);
|
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | } |
| | | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | } |
| | | |
| | | public override void UnInit() |
| | | {
|
| | | OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent; |
| | | OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent; |
| | | OperationTimeHepler.Instance.operationAdvanceEvent -= OperationAdvanceEvent; |
| | | storeModel.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent; |
| | | vipModel.rechargeCountEvent -= VipModel_rechargeCountEvent; |
| | | } |
| | | private void VipModel_rechargeCountEvent(int obj)
|
| | | {
|
| | | if (IsOpen)
|
| | | {
|
| | | UpdateRedpoint();
|
| | | }
|
| | | } |
| | | public bool IsOpen
|
| | | { |
| | | get
|
| | | { |
| | | return OperationTimeHepler.Instance.SatisfyOpenCondition(operaType); |
| | | } |
| | | } |
| | | |
| | | public bool priorityOpen
|
| | | { |
| | | get
|
| | | { |
| | | return redPoint.state == RedPointState.Simple; |
| | | } |
| | | } |
| | | |
| | | public bool IsAdvance
|
| | | { |
| | | get
|
| | | { |
| | | return OperationTimeHepler.Instance.SatisfyAdvanceCondition(operaType); |
| | | } |
| | | } |
| | | |
| | | private void OperationEndEvent(Operation type, int state) |
| | | { |
| | | if (type == operaType && state == 0) |
| | | { |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | UpdateRedpoint(); |
| | | } |
| | | }
|
| | |
|
| | | private void RefreshBuyShopLimitEvent()
|
| | | { |
| | | UpdateRedpoint(); |
| | | } |
| | | |
| | | private void OperationAdvanceEvent(Operation type) |
| | | { |
| | | if (type == operaType) |
| | | { |
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void OperationStartEvent(Operation type, int state) |
| | | { |
| | | if (type == operaType && state == 0) |
| | | {
|
| | | if (onStateUpdate != null) |
| | | { |
| | | onStateUpdate(activityID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //0 不可领取 1 可领取 2 已领取 |
| | | public int GetBuyGiftState(int count) |
| | | {
|
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out act);
|
| | |
|
| | | if (act == null) return 0;
|
| | | if (GetBuyTotalCnt() < count) return 0;
|
| | | if (((int)Math.Pow(2, count) & GiftAwardRecord) == 0) |
| | | { |
| | | return 1; |
| | | } |
| | | return 2; |
| | | } |
| | | |
| | | public int GetBuyTotalCnt()
|
| | | {
|
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out act);
|
| | |
|
| | | if (act == null) return 0; |
| | | int total = 0; |
| | | for (int i = 0; i < act.ctgIDs.Count; i++) |
| | | {
|
| | | int ctgID = act.ctgIDs[i];
|
| | | VipModel.RechargeCount rechargeCount;
|
| | | if (vipModel.TryGetRechargeCount(ctgID, out rechargeCount))
|
| | | {
|
| | | total += rechargeCount.totalCount;
|
| | | }
|
| | | } |
| | | return total; |
| | | } |
| | | |
| | | public Int2 GetBuyCntInfo(int ctgID)
|
| | | {
|
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out act);
|
| | |
|
| | | VipModel.RechargeCount rechargeCount;
|
| | | vipModel.TryGetRechargeCount(ctgID, out rechargeCount);
|
| | |
|
| | | var ctgConfig = CTGConfig.Get(ctgID);
|
| | | int buyCnt = 0;
|
| | | int totalCnt = 0;
|
| | | if (ctgConfig.DailyBuyCount != 0)
|
| | | {
|
| | | buyCnt = rechargeCount.todayCount;
|
| | | totalCnt = ctgConfig.DailyBuyCount;
|
| | | }
|
| | | else
|
| | | {
|
| | | buyCnt = rechargeCount.totalCount;
|
| | | totalCnt = ctgConfig.TotalBuyCount;
|
| | | } |
| | | |
| | | return new Int2(buyCnt, totalCnt); |
| | | } |
| | | |
| | | private void UpdateRedpoint() |
| | | { |
| | | redPoint.state = RedPointState.None; |
| | | if (!IsOpen) return; |
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(operaType, out act); |
| | | if (act == null) return; //封包顺序如果有问题 此处为空 |
| | | |
| | | for (int i = 0; i < act.buyCountGifts.Count; i++) |
| | | { |
| | | if (GetBuyGiftState(act.buyCountGifts[i].NeedBuyCount) == 1) |
| | | { |
| | | redPoint.state = RedPointState.Simple; |
| | | return; |
| | | } |
| | | }
|
| | |
|
| | | //商店免费
|
| | |
|
| | | List<StoreConfig> _list = null; |
| | | StoreConfig.TryGetStoreConfigs(act.shopType, out _list); |
| | | |
| | | int storeCnt = _list == null ? 0 : _list.Count; |
| | | |
| | | for (int i = 0; i < storeCnt; i++)
|
| | | {
|
| | | if (_list[i].MoneyNumber == 0)
|
| | | {
|
| | | int remainNum;
|
| | | storeModel.TryGetIsSellOut(_list[i], out remainNum); |
| | | if (remainNum > 0) |
| | | redPoint.state = RedPointState.Simple; |
| | | }
|
| | | } |
| | | } |
| | | |
| | | public void UpdateBuyCountGiftPlayerInfo(HAA75_tagMCActBuyCountGiftPlayerInfo netPack) |
| | | { |
| | | if (actNum != netPack.ActNum) return;
|
| | |
|
| | | GiftAwardRecord = (int)netPack.GiftAwardRecord; |
| | | UpdateRechargeGiftActEvent?.Invoke(); |
| | | |
| | | UpdateRedpoint(); |
| | | }
|
| | |
|
| | | public void SendGetAward(int count) |
| | | { |
| | | CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward(); |
| | | getReward.RewardType = 72; |
| | | getReward.DataEx = (uint)count; |
| | | getReward.DataExStr = actNum.ToString(); |
| | | getReward.DataExStrLen = (byte)getReward.DataExStr.Length; |
| | | GameNetSystem.Instance.SendInfo(getReward); |
| | | }
|
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6eb98c9103a4b2b4bb6a017a68497449 |
| | | 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.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | public class FairyAffinityRechargeGiftActWin : Window |
| | | { |
| | | [SerializeField] Text buyCountGiftText; |
| | | [SerializeField] Slider buyCountGiftSlider; |
| | | [SerializeField] Text buyCountGiftSliderText; |
| | | |
| | | [SerializeField] List<ItemCell> freeItems; |
| | | [SerializeField] List<RotationTween> freeTweenList = new List<RotationTween>(); |
| | | [SerializeField] List<ImageEx> freeGreys; |
| | | [SerializeField] List<ImageEx> freeLocks; |
| | | [SerializeField] List<ImageEx> freeHaves; |
| | | |
| | | [SerializeField] List<ItemCell> buyCountGiftItems;
|
| | | [SerializeField] List<RotationTween> buyCountGiftTweenList = new List<RotationTween>();
|
| | | [SerializeField] List<ImageEx> buyCountGiftGreys; |
| | | [SerializeField] List<ImageEx> buyCountGiftLocks; |
| | | [SerializeField] List<ImageEx> buyCountGiftHaves; |
| | | |
| | | [SerializeField] ScrollerController m_Controller;
|
| | | [SerializeField] Text actTime; |
| | | FairyAffinityRechargeGiftActModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityRechargeGiftActModel>(); } } |
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
| | |
|
| | | StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
|
| | | |
| | | #region Built-in |
| | |
|
| | | int curValue = 0;
|
| | |
|
| | | private void OnEnable()
|
| | | {
|
| | | model.PlayAnimationSync += OnPlaySyncAnimation;
|
| | | if (curValue == 0)
|
| | | return;
|
| | | int freeState = model.GetBuyGiftState(0);
|
| | | int cntState = model.GetBuyGiftState(model.getGiftCount);
|
| | |
|
| | | for (int i = 0; i < freeTweenList.Count; i++)
|
| | | {
|
| | | freeTweenList[i].Stop();
|
| | | freeTweenList[i].SetStartState();
|
| | | }
|
| | | for (int i = 0; i < buyCountGiftTweenList.Count; i++)
|
| | | {
|
| | | buyCountGiftTweenList[i].Stop();
|
| | | buyCountGiftTweenList[i].SetStartState();
|
| | | }
|
| | |
|
| | | if (freeState == 1)
|
| | | {
|
| | | for (int i = 0; i < freeTweenList.Count; i++)
|
| | | {
|
| | | freeTweenList[i].Play();
|
| | | }
|
| | | }
|
| | |
|
| | | if (cntState == 1)
|
| | | {
|
| | | for (int i = 0; i < buyCountGiftTweenList.Count; i++)
|
| | | {
|
| | | buyCountGiftTweenList[i].Play();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | model.PlayAnimationSync -= OnPlaySyncAnimation;
|
| | | }
|
| | | |
| | | protected override void BindController() |
| | | {
|
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | {
|
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | m_Controller.OnRefreshCell += OnRefreshCell; |
| | | model.UpdateRechargeGiftActEvent += DisplayAward; |
| | | GlobalTimeEvent.Instance.secondEvent += secondEvent; |
| | | vipModel.rechargeCountEvent += VipModel_rechargeCountEvent; |
| | | storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent;
|
| | |
|
| | | DisplayScroll();
|
| | | DisplayAward(); |
| | | secondEvent(); |
| | | }
|
| | |
|
| | | private void VipModel_rechargeCountEvent(int obj)
|
| | | {
|
| | | m_Controller.m_Scorller.RefreshActiveCellViews();
|
| | | DisplayAward();
|
| | | model.IsPlayAnimation = true;
|
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | {
|
| | | model.IsPlayAnimation = true;
|
| | | for (int i = 0; i < freeTweenList.Count; i++)
|
| | | {
|
| | | freeTweenList[i].Stop();
|
| | | freeTweenList[i].SetStartState();
|
| | | }
|
| | | for (int i = 0; i < buyCountGiftTweenList.Count; i++)
|
| | | {
|
| | | buyCountGiftTweenList[i].Stop();
|
| | | buyCountGiftTweenList[i].SetStartState();
|
| | | }
|
| | | int freeState = model.GetBuyGiftState(0);
|
| | | int cntState = model.GetBuyGiftState(model.getGiftCount);
|
| | |
|
| | | for (int i = 0; i < freeTweenList.Count; i++)
|
| | | {
|
| | | if (freeTweenList[i].isActiveAndEnabled && freeState == 1)
|
| | | {
|
| | | freeTweenList[i].Play();
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < buyCountGiftTweenList.Count; i++)
|
| | | {
|
| | | if (buyCountGiftTweenList[i].isActiveAndEnabled && cntState == 1)
|
| | | {
|
| | | buyCountGiftTweenList[i].Play();
|
| | | }
|
| | | } |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | m_Controller.OnRefreshCell -= OnRefreshCell; |
| | | model.UpdateRechargeGiftActEvent -= DisplayAward; |
| | | GlobalTimeEvent.Instance.secondEvent -= secondEvent; |
| | | vipModel.rechargeCountEvent -= VipModel_rechargeCountEvent; |
| | | storeModel.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent; |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | }
|
| | |
|
| | | #endregion |
| | |
|
| | | private void RefreshBuyShopLimitEvent()
|
| | | {
|
| | | m_Controller.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | | private void DisplayScroll() |
| | | {
|
| | | m_Controller.Refresh(); |
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityRechargeGiftActModel.operaType, out act); |
| | | |
| | | List<StoreConfig> _list = null; |
| | | StoreConfig.TryGetStoreConfigs(act.shopType, out _list); |
| | | |
| | | int totaleCnt = (_list == null ? 0 : _list.Count) + act.ctgIDs.Count; |
| | | |
| | | for (int i = 0; i < totaleCnt; i++) |
| | | { |
| | | m_Controller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | m_Controller.Restart(); |
| | | m_Controller.m_Scorller.RefreshActiveCellViews(); |
| | | m_Controller.JumpIndex(GetDefaultSelect()); |
| | | |
| | | //取一档商品识别 是否有商品的每日重置,与活动的每日重置判断显示 |
| | | //var config = CTGConfig.Get(act.ctgIDs[0]); |
| | | //resetTip.SetActive(!act.dayReset && config.DailyBuyCount != 0); |
| | | } |
| | | |
| | | private void DisplayAward()
|
| | | {
|
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityRechargeGiftActModel.operaType, out act);
|
| | | int freeState = model.GetBuyGiftState(0);
|
| | | int cntState = model.GetBuyGiftState(model.getGiftCount); |
| | |
|
| | | var awardInfo = act.buyCountGifts[0];
|
| | | var awards = awardInfo.AwardItemList;
|
| | |
|
| | | for (int i = 0; i < freeItems.Count; i++) |
| | | { |
| | | if (i < awards.Length) |
| | | { |
| | | var award = awards[i]; |
| | | freeItems[i].SetActive(true); |
| | | var itemData = new ItemCellModel((int)award.ItemID, false, award.ItemCount); |
| | | freeItems[i].Init(itemData); |
| | | int index = i; |
| | | freeItems[i].button.SetListener(() =>
|
| | | { |
| | | if (freeState == 1)
|
| | | {
|
| | | model.SendGetAward(0);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemTipUtility.Show((int)award.ItemID); |
| | | }
|
| | | }); |
| | | freeGreys[i].SetActive(freeState == 0 || freeState == 2);
|
| | | freeLocks[i].SetActive(freeState == 0);
|
| | | freeHaves[i].SetActive(freeState == 2); |
| | | } |
| | | else |
| | | { |
| | | freeItems[i].SetActive(false); |
| | | freeGreys[i].SetActive(false);
|
| | | freeLocks[i].SetActive(false);
|
| | | freeHaves[i].SetActive(false); |
| | | } |
| | | }
|
| | |
|
| | | awardInfo = act.buyCountGifts[GetIndex(model.getGiftCount)];
|
| | | awards = awardInfo.AwardItemList; |
| | | for (int i = 0; i < buyCountGiftItems.Count; i++) |
| | | { |
| | | if (i < awards.Length) |
| | | { |
| | | var award = awards[i]; |
| | | buyCountGiftItems[i].SetActive(true); |
| | | var itemData = new ItemCellModel((int)award.ItemID, false, award.ItemCount); |
| | | buyCountGiftItems[i].Init(itemData); |
| | | int index = i; |
| | | buyCountGiftItems[i].button.SetListener(() =>
|
| | | { |
| | | if (cntState == 1)
|
| | | {
|
| | | model.SendGetAward(model.getGiftCount);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemTipUtility.Show((int)award.ItemID); |
| | | } |
| | | }); |
| | | buyCountGiftGreys[i].SetActive(cntState == 0 || cntState == 2);
|
| | | buyCountGiftLocks[i].SetActive(cntState == 0);
|
| | | buyCountGiftHaves[i].SetActive(cntState == 2); |
| | | } |
| | | else |
| | | { |
| | | buyCountGiftItems[i].SetActive(false);
|
| | | buyCountGiftGreys[i].SetActive(false);
|
| | | buyCountGiftLocks[i].SetActive(false);
|
| | | buyCountGiftHaves[i].SetActive(false); |
| | | } |
| | | }
|
| | |
|
| | | int totalBuyCnt = model.GetBuyTotalCnt(); |
| | | buyCountGiftSlider.value = totalBuyCnt / (float)model.getGiftCount; |
| | | buyCountGiftSliderText.text = string.Format("{0}/{1}", totalBuyCnt, model.getGiftCount); |
| | | buyCountGiftText.text = Language.Get("FairyAffinity11", Mathf.Max(0, model.getGiftCount - totalBuyCnt));
|
| | |
|
| | | model.IsPlayAnimation = true; |
| | | } |
| | | |
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | if (type != ScrollerDataType.Header) return; |
| | | |
| | | var _cell = cell as FairyAffinityRechargeGiftActCell;
|
| | |
|
| | | _cell.Display(_cell.index);
|
| | | }
|
| | |
|
| | | private int GetDefaultSelect() |
| | | { |
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityRechargeGiftActModel.operaType, out act);
|
| | |
|
| | | List<StoreConfig> _list = null; |
| | | StoreConfig.TryGetStoreConfigs(act.shopType, out _list); |
| | | |
| | | int storeCnt = _list == null ? 0 : _list.Count; |
| | | |
| | | for (int i = 0; i < storeCnt; i++)
|
| | | {
|
| | | int remainNum;
|
| | | storeModel.TryGetIsSellOut(_list[i], out remainNum); |
| | | if (remainNum > 0) |
| | | return i; |
| | | } |
| | | |
| | | //跳过已购买 |
| | | for (int i = 0; i < act.ctgIDs.Count; i++) |
| | | {
|
| | | int ctgID = act.ctgIDs[i];
|
| | | var countInfo = model.GetBuyCntInfo(ctgID);
|
| | |
|
| | | if (countInfo.x < countInfo.y)
|
| | | return i + storeCnt;
|
| | | } |
| | | return 0;
|
| | | }
|
| | |
|
| | | private void secondEvent() |
| | | {
|
| | | |
| | | actTime.text = Language.Get("FairyAffinity10", TimeUtility.SecondsToDHMSCHS(GetTime())); |
| | | } |
| | | |
| | | public int GetTime()
|
| | | {
|
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityRechargeGiftActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return 0;
|
| | | int seconds;
|
| | | switch (act.resetType)
|
| | | {
|
| | | case 0:
|
| | | {
|
| | | DateTime endOperationTime = new DateTime(TimeUtility.Year, TimeUtility.Month,
|
| | | TimeUtility.Day, 0, 0, 0);
|
| | | endOperationTime = endOperationTime.AddDays(1);
|
| | | seconds = (int)(endOperationTime - TimeUtility.ServerNow).TotalSeconds;
|
| | | }
|
| | | break;
|
| | | case 1:
|
| | | {
|
| | | DateTime endOperationTime = new DateTime(TimeUtility.Year, TimeUtility.Month,
|
| | | TimeUtility.Day, 5, 0, 0);
|
| | | endOperationTime = endOperationTime.AddDays(1);
|
| | | seconds = (int)(endOperationTime - TimeUtility.ServerNow).TotalSeconds;
|
| | | }
|
| | | break;
|
| | | default:
|
| | | return 0;
|
| | | }
|
| | | return seconds;
|
| | | } |
| | | |
| | | private int GetIndex(int cnt)
|
| | | {
|
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityRechargeGiftActModel.operaType, out act); |
| | | if (act == null) return 0;
|
| | | for (int i = 0; i < act.buyCountGifts.Count; i++) |
| | | {
|
| | | if (act.buyCountGifts[i].NeedBuyCount == cnt)
|
| | | {
|
| | | return i;
|
| | | }
|
| | | }
|
| | | return 0;
|
| | | } |
| | | |
| | | private int GetAwardShowIndex()
|
| | | {
|
| | | OperationRechargeGiftAct act; |
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityRechargeGiftActModel.operaType, out act); |
| | | if (act == null) return 0; |
| | | |
| | | for (int i = 0; i < act.buyCountGifts.Count; i++) |
| | | { |
| | | if (model.GetBuyGiftState(act.buyCountGifts[i].NeedBuyCount) != 2) |
| | | { |
| | | return i; |
| | | } |
| | | } |
| | | return act.buyCountGifts.Count - 1; |
| | | }
|
| | | |
| | | private void OnPlaySyncAnimation()
|
| | | {
|
| | | for (int i = 0; i < freeTweenList.Count; i++)
|
| | | {
|
| | | freeTweenList[i].Stop();
|
| | | freeTweenList[i].SetStartState();
|
| | | }
|
| | | for (int i = 0; i < buyCountGiftTweenList.Count; i++)
|
| | | {
|
| | | buyCountGiftTweenList[i].Stop();
|
| | | buyCountGiftTweenList[i].SetStartState();
|
| | | }
|
| | | int freeState = model.GetBuyGiftState(0);
|
| | | int cntState = model.GetBuyGiftState(model.getGiftCount);
|
| | |
|
| | | for (int i = 0; i < freeTweenList.Count; i++)
|
| | | {
|
| | | if (freeTweenList[i].isActiveAndEnabled && freeState == 1)
|
| | | {
|
| | | freeTweenList[i].Play();
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < buyCountGiftTweenList.Count; i++)
|
| | | {
|
| | | if (buyCountGiftTweenList[i].isActiveAndEnabled && cntState == 1)
|
| | | {
|
| | | buyCountGiftTweenList[i].Play();
|
| | | }
|
| | | }
|
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4bcb7f1535ab60546a4f825435ae8475 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | // 仙缘
|
| | | public class FairyAffinityWin : Window
|
| | | {
|
| | | [SerializeField] FunctionButton btnZhanLing;
|
| | | [SerializeField] FunctionButton btnFuLu;
|
| | | [SerializeField] FunctionButton btnTask;
|
| | | [SerializeField] FunctionButton btnGift;
|
| | | [SerializeField] FunctionButtonGroup buttonGroup;
|
| | | [SerializeField] ImageEx imgTitle;
|
| | | [SerializeField] ImageEx imgInfo;
|
| | | [SerializeField] ButtonEx btnClose;
|
| | | [SerializeField] Transform tranBottomInfo;
|
| | | [SerializeField] TextEx txtCheckInCnt;
|
| | | [SerializeField] TextEx txtTaskResetTime;
|
| | | FairyAffinityModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityModel>(); } }
|
| | | FairyAffinityLoginActModel fairyAffinityLoginActModel { get { return ModelCenter.Instance.GetModel<FairyAffinityLoginActModel>(); } }
|
| | |
|
| | | #region Built-in
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | btnZhanLing.SetListener(OnZhanLing);
|
| | | btnFuLu.SetListener(OnFuLu);
|
| | | btnTask.SetListener(OnTask);
|
| | | btnGift.SetListener(OnGift);
|
| | | btnClose.SetListener(CloseClick);
|
| | | }
|
| | |
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | GlobalTimeEvent.Instance.secondEvent += secondEvent;
|
| | | ChangeTabShow();
|
| | | ChangeBottomInfo();
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | GlobalTimeEvent.Instance.secondEvent -= secondEvent;
|
| | | }
|
| | |
|
| | | private void secondEvent()
|
| | | {
|
| | | ChangeBottomInfo();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnActived()
|
| | | {
|
| | | base.OnActived();
|
| | | buttonGroup.TriggerByOrder(functionOrder);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | public void OnZhanLing()
|
| | | {
|
| | | CloseChildWin();
|
| | | WindowCenter.Instance.Open<FairyAffinityZhanLingWin>();
|
| | | functionOrder = 0;
|
| | | ChangeTabShow();
|
| | | ChangeBottomInfo();
|
| | | }
|
| | |
|
| | | public void OnFuLu()
|
| | | {
|
| | | CloseChildWin();
|
| | | WindowCenter.Instance.Open<FairyAffinityLoginActWin>();
|
| | | functionOrder = 1;
|
| | | ChangeTabShow();
|
| | | ChangeBottomInfo();
|
| | | }
|
| | |
|
| | | public void OnTask()
|
| | | {
|
| | | CloseChildWin();
|
| | | WindowCenter.Instance.Open<FairyAffinityMissionActWin>();
|
| | | functionOrder = 2;
|
| | | ChangeTabShow();
|
| | | ChangeBottomInfo();
|
| | | }
|
| | |
|
| | | public void OnGift()
|
| | | {
|
| | | CloseChildWin();
|
| | | functionOrder = 3;
|
| | | WindowCenter.Instance.Open<FairyAffinityRechargeGiftActWin>();
|
| | | ChangeTabShow();
|
| | | ChangeBottomInfo();
|
| | | }
|
| | |
|
| | | private void CloseChildWin()
|
| | | {
|
| | | var children = WindowConfig.GetChildWindows("FairyAffinityWin");
|
| | | foreach (var window in children)
|
| | | {
|
| | | WindowCenter.Instance.Close(window);
|
| | | }
|
| | | }
|
| | |
|
| | | private void ChangeTabShow()
|
| | | {
|
| | | ChangeTabChooseShow();
|
| | | ChangeTitleShow();
|
| | | }
|
| | |
|
| | | private void ChangeTabChooseShow()
|
| | | {
|
| | | btnZhanLing.state = btnZhanLing.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal;
|
| | | btnZhanLing.image.SetNativeSize();
|
| | | btnZhanLing.title.resizeTextMaxSize = btnZhanLing.order == functionOrder ? 22 : 18;
|
| | |
|
| | | btnFuLu.state = btnFuLu.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal;
|
| | | btnFuLu.image.SetNativeSize();
|
| | | btnFuLu.title.resizeTextMaxSize = btnFuLu.order == functionOrder ? 22 : 18;
|
| | |
|
| | | btnTask.state = btnTask.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal;
|
| | | btnTask.image.SetNativeSize();
|
| | | btnTask.title.resizeTextMaxSize = btnTask.order == functionOrder ? 22 : 18;
|
| | |
|
| | | btnGift.state = btnGift.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal;
|
| | | btnGift.image.SetNativeSize();
|
| | | btnGift.title.resizeTextMaxSize = btnGift.order == functionOrder ? 22 : 18;
|
| | | }
|
| | |
|
| | | private void ChangeTitleShow()
|
| | | {
|
| | | imgTitle.SetSprite(btnFuLu.order == functionOrder ? "FairyAffinityTitle_FuLu" : "FairyAffinityTitle_XianYuan");
|
| | | imgTitle.SetNativeSize();
|
| | |
|
| | | imgInfo.SetSprite(btnFuLu.order == functionOrder ? "FairyAffinityInfo_FuLu" : "FairyAffinityInfo_XianYuan");
|
| | | imgInfo.SetNativeSize();
|
| | | }
|
| | |
|
| | | private void ChangeBottomInfo()
|
| | | {
|
| | | tranBottomInfo.SetActive(functionOrder == 0 || functionOrder == 1);
|
| | | txtCheckInCnt.SetActive(functionOrder == 1);
|
| | | txtTaskResetTime.SetActive(functionOrder == 0 || functionOrder == 1);
|
| | |
|
| | | if (functionOrder == 0 || functionOrder == 1)
|
| | | {
|
| | | OperationLoginAct holiday;
|
| | | OperationTimeHepler.Instance.TryGetOperation(FairyAffinityLoginActModel.operaType, out holiday);
|
| | | txtTaskResetTime.text = Language.Get("FairyAffinity09", TimeUtility.SecondsToDHMSCHS(holiday.GetResetSurplusTime()));
|
| | | }
|
| | |
|
| | | if (functionOrder == 1)
|
| | | {
|
| | | txtCheckInCnt.text = Language.Get("FairyAffinity15", fairyAffinityLoginActModel.GetHaveAwardDayCnt());
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c51635f4c2006e84c9cea62bffe1619f |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | public class FairyAffinityZhanLingCell : CellView
|
| | | {
|
| | | [SerializeField] ImageEx imgUnlockLV;
|
| | | [SerializeField] ImageEx imgFreeHave;
|
| | | [SerializeField] ImageEx imgFreeLock;
|
| | | [SerializeField] ImageEx imgFreeGrizzly;
|
| | | [SerializeField] TextEx txtUnlockLV;
|
| | | [SerializeField] ItemCell freeItemCell;
|
| | | [SerializeField] List<ItemCell> paidItemCellList = new List<ItemCell>();
|
| | | [SerializeField] List<ImageEx> imgPaidHaveList = new List<ImageEx>();
|
| | | [SerializeField] List<ImageEx> imgPaidLockList = new List<ImageEx>();
|
| | | [SerializeField] List<ImageEx> imgPaidGrizzlyList = new List<ImageEx>();
|
| | | [SerializeField] ImageEx imgBrownProgressBar;
|
| | | [SerializeField] ImageEx imgGreenProgressBar;
|
| | | [SerializeField] ImageEx imgBG;
|
| | | [SerializeField] RotationTween freeItemCellTween;
|
| | | [SerializeField] List<RotationTween> paidItemCellTweenList = new List<RotationTween>();
|
| | | FairyAffinityZhanLingModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityZhanLingModel>(); } }
|
| | | int curValue = 0;
|
| | |
|
| | | private void OnEnable()
|
| | | {
|
| | | model.PlayAnimationSync += OnPlaySyncAnimation;
|
| | | if (curValue == 0)
|
| | | return;
|
| | | int freeState = model.GetGiftState(model.ZhanLingType, curValue, true);
|
| | | int paidState = model.GetGiftState(model.ZhanLingType, curValue, false);
|
| | | freeItemCellTween.Stop();
|
| | | freeItemCellTween.SetStartState();
|
| | | for (int i = 0; i < paidItemCellTweenList.Count; i++)
|
| | | {
|
| | | paidItemCellTweenList[i].Stop();
|
| | | paidItemCellTweenList[i].SetStartState();
|
| | | }
|
| | | if (freeState == 1)
|
| | | {
|
| | | freeItemCellTween.Play();
|
| | | }
|
| | | if (paidState == 1)
|
| | | {
|
| | | for (int i = 0; i < paidItemCellTweenList.Count; i++)
|
| | | {
|
| | | paidItemCellTweenList[i].Play();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void Display(int needValue)
|
| | | {
|
| | | curValue = needValue;
|
| | | int freeState = model.GetGiftState(model.ZhanLingType, needValue, true);
|
| | | int paidState = model.GetGiftState(model.ZhanLingType, needValue, false);
|
| | | imgFreeHave.SetActiveIL(freeState == 2);
|
| | | imgFreeLock.SetActiveIL(freeState == 0);
|
| | | imgFreeGrizzly.SetActiveIL(freeState == 0);
|
| | | imgGreenProgressBar.SetActiveIL(freeState != 0);
|
| | | for (int i = 0; i < paidItemCellList.Count; i++)
|
| | | {
|
| | | imgPaidHaveList[i].SetActiveIL(paidState == 2);
|
| | | imgPaidLockList[i].SetActiveIL(paidState == 0);
|
| | | imgPaidGrizzlyList[i].SetActiveIL(paidState == 0);
|
| | | }
|
| | | if (model.GetNowValue() < (ulong)needValue)
|
| | | {
|
| | | imgUnlockLV.gray = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | imgUnlockLV.gray = false;
|
| | | }
|
| | | txtUnlockLV.text = needValue.ToString();
|
| | | //让第一个cell的进度条不凸出
|
| | | if (ILZhanlingConfig.GetTypeToIDDict(model.ZhanLingType).Keys.ToList()[0] == needValue)
|
| | | {
|
| | | imgBrownProgressBar.rectTransform.sizeDelta = new Vector2(imgBG.rectTransform.sizeDelta.x, imgBrownProgressBar.rectTransform.sizeDelta.y);
|
| | | imgGreenProgressBar.rectTransform.sizeDelta = new Vector2(imgBG.rectTransform.sizeDelta.x, imgGreenProgressBar.rectTransform.sizeDelta.y);
|
| | | }
|
| | | else
|
| | | {
|
| | | imgBrownProgressBar.rectTransform.sizeDelta = new Vector2(imgBG.rectTransform.sizeDelta.x + 10, imgBrownProgressBar.rectTransform.sizeDelta.y);
|
| | | imgGreenProgressBar.rectTransform.sizeDelta = new Vector2(imgBG.rectTransform.sizeDelta.x + 10, imgGreenProgressBar.rectTransform.sizeDelta.y);
|
| | | }
|
| | | //չʾItemCell
|
| | | var itemId = model.GetItemCellID(model.ZhanLingType, needValue, true);
|
| | | var model1 = new ItemCellModel(itemId, false, (ulong)model.GetItemCellCount(model.ZhanLingType, needValue, true));
|
| | | freeItemCell.Init(model1);
|
| | | freeItemCell.button.SetListener(() =>
|
| | | {
|
| | | if (freeState == 1)
|
| | | {
|
| | | model.HaveAllZhanLingGift(model.ZhanLingType);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemTipUtility.Show(itemId);
|
| | | }
|
| | | });
|
| | |
|
| | | for (int i = 0; i < paidItemCellList.Count; i++)
|
| | | {
|
| | | var itemId2 = model.GetItemCellID(model.ZhanLingType, needValue, false, i);
|
| | | var model2 = new ItemCellModel(itemId2, false, (ulong)model.GetItemCellCount(model.ZhanLingType, needValue, false, i));
|
| | | paidItemCellList[i].Init(model2);
|
| | | paidItemCellList[i].button.SetListener(() =>
|
| | | {
|
| | | if (paidState == 1)
|
| | | {
|
| | | model.HaveAllZhanLingGift(model.ZhanLingType);
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemTipUtility.Show(itemId2);
|
| | | }
|
| | | });
|
| | | }
|
| | | //播放旋转动画
|
| | | freeItemCellTween.Stop();
|
| | | freeItemCellTween.SetStartState();
|
| | | for (int i = 0; i < paidItemCellTweenList.Count; i++)
|
| | | {
|
| | | paidItemCellTweenList[i].Stop();
|
| | | paidItemCellTweenList[i].SetStartState();
|
| | | }
|
| | |
|
| | | if (freeItemCellTween.isActiveAndEnabled && freeState == 1)
|
| | | {
|
| | | freeItemCellTween.Play();
|
| | | }
|
| | |
|
| | | for (int i = 0; i < paidItemCellTweenList.Count; i++)
|
| | | {
|
| | | if (paidItemCellTweenList[i].isActiveAndEnabled && paidState == 1)
|
| | | {
|
| | | paidItemCellTweenList[i].Play();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | model.PlayAnimationSync -= OnPlaySyncAnimation;
|
| | | }
|
| | |
|
| | | private void OnPlaySyncAnimation()
|
| | | {
|
| | | int freeState = model.GetGiftState(model.ZhanLingType, curValue, true);
|
| | | int paidState = model.GetGiftState(model.ZhanLingType, curValue, false);
|
| | | freeItemCellTween.Stop();
|
| | | freeItemCellTween.SetStartState();
|
| | | for (int i = 0; i < paidItemCellTweenList.Count; i++)
|
| | | {
|
| | | paidItemCellTweenList[i].Stop();
|
| | | paidItemCellTweenList[i].SetStartState();
|
| | | }
|
| | |
|
| | | if (freeItemCellTween.isActiveAndEnabled && freeState == 1)
|
| | | {
|
| | | freeItemCellTween.Play();
|
| | | }
|
| | |
|
| | | for (int i = 0; i < paidItemCellTweenList.Count; i++)
|
| | | {
|
| | | if (paidItemCellTweenList[i].isActiveAndEnabled && paidState == 1)
|
| | | {
|
| | | paidItemCellTweenList[i].Play();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 200e291ca7c6b4f44ac1c330f1137585 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | public class FairyAffinityZhanLingModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
| | | {
|
| | | public int ZhanLingType = 9;
|
| | | public int FuncId = 240;
|
| | | public int buyValue;//战令价值仙玉
|
| | |
|
| | | // 战令类型对应的充值ID列表
|
| | | public Dictionary<int, int> ctgIdDict = new Dictionary<int, int>();
|
| | |
|
| | | //收到的所有服务器战令包字典
|
| | | public Dictionary<int, ZhanlingInfo> zhanLingInfoDict = new Dictionary<int, ZhanlingInfo>();
|
| | |
|
| | | //战令类型: 所需值 :key
|
| | | public Dictionary<int, Dictionary<int, int>> typeToIDListDict = new Dictionary<int, Dictionary<int, int>>();
|
| | |
|
| | | public event Action UpdateGiftStateEvent;
|
| | | public Redpoint redpoint = new Redpoint(MainRedDot.FairyAffinityRepoint, MainRedDot.FairyAffinityRepoint * 10 + 1);
|
| | | List<ZhanLingGiftItemInfo> allGiftItemList = new List<ZhanLingGiftItemInfo>();
|
| | |
|
| | | //同步播放摆动动画
|
| | | public Action PlayAnimationSync;
|
| | |
|
| | | private bool isPlayAnimation = false;
|
| | | public bool IsPlayAnimation
|
| | | {
|
| | | get
|
| | | {
|
| | | return isPlayAnimation;
|
| | | }
|
| | | set
|
| | | {
|
| | | isPlayAnimation = value;
|
| | | if (isPlayAnimation)
|
| | | {
|
| | | PlayAnimationSync?.Invoke();
|
| | | }
|
| | | isPlayAnimation = false;
|
| | | }
|
| | | }
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | PlayerDatas.Instance.playerDataRefreshEvent += OnplayerDataRefreshEvent;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent += OnFunctionStateChange;
|
| | | ctgIdDict = GeneralDefine.OldZhanLingCtgIdDict;
|
| | | typeToIDListDict = ILZhanlingConfig.GetAllTypeToIDListDict();
|
| | | buyValue = int.Parse(FuncConfigConfig.Get("FairyAffinity").Numerical1);
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | PlayerDatas.Instance.playerDataRefreshEvent -= OnplayerDataRefreshEvent;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFunctionStateChange;
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | zhanLingInfoDict.Clear();
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | }
|
| | |
|
| | | private void OnplayerDataRefreshEvent(PlayerDataType type)
|
| | | {
|
| | | if (type == PlayerDataType.default42)
|
| | | {
|
| | | UpdateRedpoint(ZhanLingType);
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateGiftState(HB120_tagMCZhanlingInfo vNetData)
|
| | | {
|
| | | if (zhanLingInfoDict.ContainsKey(vNetData.ZhanlingType))
|
| | | {
|
| | | zhanLingInfoDict[vNetData.ZhanlingType].isActivite = vNetData.IsActivite;
|
| | | zhanLingInfoDict[vNetData.ZhanlingType].isActiviteH = vNetData.IsActiviteH;
|
| | | if (vNetData.RewardCount != 0)
|
| | | {
|
| | | for (int i = 0; i < vNetData.RewardCount; i++)
|
| | | {
|
| | | zhanLingInfoDict[vNetData.ZhanlingType].freeZhanHaveDict[(int)vNetData.RewardList[i].NeedValue] = (int)vNetData.RewardList[i].FreeRewardState;
|
| | | zhanLingInfoDict[vNetData.ZhanlingType].paidZhanHaveDict[(int)vNetData.RewardList[i].NeedValue] = (int)vNetData.RewardList[i].ZLRewardState;
|
| | | zhanLingInfoDict[vNetData.ZhanlingType].paidZhanHaveHDict[(int)vNetData.RewardList[i].NeedValue] = (int)vNetData.RewardList[i].ZLRewardStateH;
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | ZhanlingInfo zhanlingInfo = new ZhanlingInfo();
|
| | | zhanlingInfo.zhanLingType = vNetData.ZhanlingType;
|
| | | zhanlingInfo.isActivite = vNetData.IsActivite;
|
| | | zhanlingInfo.isActiviteH = vNetData.IsActiviteH;
|
| | | zhanlingInfo.rewardCount = vNetData.RewardCount;
|
| | | zhanlingInfo.value1 = (int)vNetData.Value1;
|
| | | zhanlingInfo.freeZhanHaveDict = new Dictionary<int, int>();
|
| | | zhanlingInfo.paidZhanHaveDict = new Dictionary<int, int>();
|
| | | zhanlingInfo.paidZhanHaveHDict = new Dictionary<int, int>();
|
| | | for (int i = 0; i < zhanlingInfo.rewardCount; i++)
|
| | | {
|
| | | zhanlingInfo.freeZhanHaveDict[(int)vNetData.RewardList[i].NeedValue] = vNetData.RewardList[i].FreeRewardState;
|
| | | zhanlingInfo.paidZhanHaveDict[(int)vNetData.RewardList[i].NeedValue] = vNetData.RewardList[i].ZLRewardState;
|
| | | zhanlingInfo.paidZhanHaveHDict[(int)vNetData.RewardList[i].NeedValue] = vNetData.RewardList[i].ZLRewardStateH;
|
| | | }
|
| | | zhanLingInfoDict[zhanlingInfo.zhanLingType] = zhanlingInfo;
|
| | | }
|
| | | if (vNetData.ZhanlingType == ZhanLingType)
|
| | | {
|
| | | UpdateGiftStateEvent?.Invoke();
|
| | | UpdateRedpoint(ZhanLingType);
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnFunctionStateChange(int id)
|
| | | {
|
| | | if (id == FuncId)
|
| | | {
|
| | | UpdateRedpoint(ZhanLingType);
|
| | | }
|
| | | }
|
| | |
|
| | | public ulong GetNowValue()
|
| | | {
|
| | | return UIHelper.GetMoneyCnt(49);
|
| | | }
|
| | |
|
| | | // 获得当前按钮显示的状态
|
| | | // 0 不能领 1 未领取 2 已领取
|
| | | public int GetGiftState(int zhanLingType, int needValue, bool isFreeGift)
|
| | | {
|
| | | if (GetNowValue() >= (ulong)needValue)
|
| | | {
|
| | | //是不是免费礼包
|
| | | if (isFreeGift)
|
| | | {
|
| | | return IsHaveZhanLingGift(zhanLingType, needValue, true) ? 2 : 1;
|
| | | }
|
| | | else
|
| | | {
|
| | | //买没买过付费战令
|
| | | if (IsBuy())
|
| | | {
|
| | | return IsHaveZhanLingGift(zhanLingType, needValue, false) ? 2 : 1;
|
| | | }
|
| | | else
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsBuy()
|
| | | {
|
| | | return zhanLingInfoDict[ZhanLingType].isActivite > 0;
|
| | | }
|
| | |
|
| | | //发包
|
| | | public void HaveGift(int zhanLingType, int needValue, bool isFreeGift)
|
| | | {
|
| | | var pak = new IL_CA504_tagCMPlayerGetReward();
|
| | | string dataExStr = isFreeGift ? (needValue * 10 + 0).ToString() : (needValue * 10 + 1).ToString();
|
| | | pak.RewardType = (byte)65;
|
| | | pak.DataEx = (uint)zhanLingType;
|
| | | pak.DataExStrLen = (byte)dataExStr.Length;
|
| | | pak.DataExStr = dataExStr;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | |
|
| | | //是否领取了当前这档的物品
|
| | | public bool IsHaveZhanLingGift(int zhanLingType, int needValue, bool isFreeGift)
|
| | | {
|
| | | return isFreeGift ? zhanLingInfoDict[zhanLingType].freeZhanHaveDict[needValue] > 0 : zhanLingInfoDict[zhanLingType].paidZhanHaveDict[needValue] > 0;
|
| | | }
|
| | |
|
| | | //获取ItemCell的ID
|
| | | public int GetItemCellID(int zhanLingType, int needValue, bool isFreeGift, int loopIndedx = 0)
|
| | | {
|
| | | return isFreeGift ? ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][needValue]).FreeRewardItemList[0][0] : ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][needValue]).ZLRewardItemList[loopIndedx][0];
|
| | | }
|
| | |
|
| | | //获取ItemCell的数量
|
| | | public int GetItemCellCount(int zhanLingType, int needValue, bool isFreeGift, int loopIndedx = 0)
|
| | | {
|
| | | return isFreeGift ? ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][needValue]).FreeRewardItemList[0][1] : ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][needValue]).ZLRewardItemList[loopIndedx][1];
|
| | | }
|
| | |
|
| | | //获取最小未领取的物品索引
|
| | | public int GetJumpStartIndex(int zhanLingType)
|
| | | {
|
| | | int nowNeedValue = PlayerDatas.Instance.baseData.LV;
|
| | | List<int> zhanLingLvList = ILZhanlingConfig.GetTypeToIDDict(zhanLingType).Keys.ToList();
|
| | | int maxNeedValue = ILZhanlingConfig.GetTypeToIDDict(zhanLingType).Keys.ToList()[0];
|
| | | for (int i = 0; i < zhanLingLvList.Count; i++)
|
| | | {
|
| | | if (nowNeedValue >= zhanLingLvList[i])
|
| | | {
|
| | | if (zhanLingInfoDict[zhanLingType].isActivite > 0)
|
| | | {
|
| | | if (!IsHaveZhanLingGift(zhanLingType, zhanLingLvList[i], false) || !IsHaveZhanLingGift(zhanLingType, zhanLingLvList[i], true))
|
| | | {
|
| | | maxNeedValue = zhanLingLvList[i];
|
| | | break;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (!IsHaveZhanLingGift(zhanLingType, zhanLingLvList[i], true))
|
| | | {
|
| | | maxNeedValue = zhanLingLvList[i];
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return Math.Max(0, ILZhanlingConfig.GetTypeToIDDict(zhanLingType)[maxNeedValue] - 1);
|
| | | }
|
| | |
|
| | | //一键获取所有可领取的礼品,弹出展示窗口
|
| | | public void HaveAllZhanLingGift(int zhanLingType)
|
| | | {
|
| | | //没有格子
|
| | | if (ModelCenter.Instance.GetModelEx<PackModel>().GetEmptyGridCount(PackType.Item) < 1)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("GeRen_lhs_202580");
|
| | | return;
|
| | | }
|
| | | List<int> haveFreeRewardItemList = new List<int>(); //用户领到的免费物品的所需值列表
|
| | | List<int> havePaidRewardItemList = new List<int>(); //用户领到的付费物品的所需值列表
|
| | | var needValueList = ILZhanlingConfig.GetTypeToIDDict(zhanLingType).Keys.ToList();
|
| | | for (int i = 0; i < needValueList.Count; i++)
|
| | | {
|
| | | int freeState = GetGiftState(zhanLingType, needValueList[i], true);
|
| | | int paidState = GetGiftState(zhanLingType, needValueList[i], false);
|
| | | if (freeState == 1)
|
| | | {
|
| | | haveFreeRewardItemList.Add(needValueList[i]);
|
| | | }
|
| | | if (paidState == 1)
|
| | | {
|
| | | havePaidRewardItemList.Add(needValueList[i]);
|
| | | }
|
| | | }
|
| | | MergeAllHaveZhanLingGift(zhanLingType, haveFreeRewardItemList, havePaidRewardItemList);
|
| | | DebugEx.Log($"背包空格 {ModelCenter.Instance.GetModelEx<PackModel>().GetEmptyGridCount(PackType.Item)} 需要格子 {allGiftItemList.Count}");
|
| | | if (ModelCenter.Instance.GetModelEx<PackModel>().GetEmptyGridCount(PackType.Item) >= allGiftItemList.Count)
|
| | | {
|
| | | for (int i = 0; i < needValueList.Count; i++)
|
| | | {
|
| | | int freeState = GetGiftState(zhanLingType, needValueList[i], true);
|
| | | int paidState = GetGiftState(zhanLingType, needValueList[i], false);
|
| | | if (freeState == 1)
|
| | | {
|
| | | HaveGift(zhanLingType, needValueList[i], true);
|
| | | }
|
| | | if (paidState == 1)
|
| | | {
|
| | | HaveGift(zhanLingType, needValueList[i], false);
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("GeRen_lhs_202580");
|
| | | return;
|
| | | }
|
| | | HaveZhanLingItemShowModel.Instance.allGiftItemList = new List<ZhanLingGiftItemInfo>(SortAllHaveZhanLingGift());
|
| | | allGiftItemList.Clear();
|
| | | WindowJumpMgr.Instance.WindowJumpToEx("HaveZhanLingItemShowWin");
|
| | | }
|
| | |
|
| | | public void MergeAllHaveZhanLingGift(int zhanLingType, List<int> haveFreeRewardItemList, List<int> havePaidRewardItemList)
|
| | | {
|
| | | for (int i = 0; i < haveFreeRewardItemList.Count; i++)
|
| | | {
|
| | | for (int j = 0; j < ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][haveFreeRewardItemList[i]]).FreeRewardItemList.Length; j++)
|
| | | {
|
| | | ZhanLingGiftItemInfo tempAllGiftItems = new ZhanLingGiftItemInfo();
|
| | | tempAllGiftItems.id = ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][haveFreeRewardItemList[i]]).FreeRewardItemList[j][0];
|
| | | tempAllGiftItems.count = ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][haveFreeRewardItemList[i]]).FreeRewardItemList[j][1];
|
| | | tempAllGiftItems.name = ItemConfig.Get(tempAllGiftItems.id).ItemName;
|
| | | tempAllGiftItems.quality = ItemConfig.Get(tempAllGiftItems.id).ItemColor;
|
| | | if (allGiftItemList.Count == 0)
|
| | | {
|
| | | allGiftItemList.Add(tempAllGiftItems);
|
| | | }
|
| | | else
|
| | | {
|
| | | bool isExist = false;
|
| | | for (int k = 0; k < allGiftItemList.Count; k++)
|
| | | {
|
| | | if (allGiftItemList[k].id == tempAllGiftItems.id)
|
| | | {
|
| | | isExist = true;
|
| | | allGiftItemList[k].count += tempAllGiftItems.count;
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (!isExist)
|
| | | {
|
| | | allGiftItemList.Add(tempAllGiftItems);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | for (int i = 0; i < havePaidRewardItemList.Count; i++)
|
| | | {
|
| | | for (int j = 0; j < ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][havePaidRewardItemList[i]]).ZLRewardItemList.Length; j++)
|
| | | {
|
| | | ZhanLingGiftItemInfo tempAllGiftItems = new ZhanLingGiftItemInfo();
|
| | | tempAllGiftItems.id = ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][havePaidRewardItemList[i]]).ZLRewardItemList[j][0];
|
| | | tempAllGiftItems.count = ILZhanlingConfig.Get(typeToIDListDict[zhanLingType][havePaidRewardItemList[i]]).ZLRewardItemList[j][1];
|
| | | tempAllGiftItems.name = ItemConfig.Get(tempAllGiftItems.id).ItemName;
|
| | | tempAllGiftItems.quality = ItemConfig.Get(tempAllGiftItems.id).ItemColor;
|
| | | if (allGiftItemList.Count == 0)
|
| | | {
|
| | | allGiftItemList.Add(tempAllGiftItems);
|
| | | }
|
| | | else
|
| | | {
|
| | | bool isExist = false;
|
| | | for (int k = 0; k < allGiftItemList.Count; k++)
|
| | | {
|
| | | if (allGiftItemList[k].id == tempAllGiftItems.id)
|
| | | {
|
| | | isExist = true;
|
| | | allGiftItemList[k].count += tempAllGiftItems.count;
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (!isExist)
|
| | | {
|
| | | allGiftItemList.Add(tempAllGiftItems);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private int SortGift(ZhanLingGiftItemInfo a, ZhanLingGiftItemInfo b)
|
| | | {
|
| | | return b.quality.CompareTo(a.quality);
|
| | | }
|
| | |
|
| | | //按品质排序
|
| | | public List<ZhanLingGiftItemInfo> SortAllHaveZhanLingGift()
|
| | | {
|
| | | allGiftItemList.Sort(SortGift);
|
| | | return allGiftItemList;
|
| | | }
|
| | |
|
| | | private void UpdateRedpoint(int zhanLingType)
|
| | | {
|
| | | redpoint.state = RedPointState.None;
|
| | | if (zhanLingInfoDict == null || !zhanLingInfoDict.ContainsKey(zhanLingType) || zhanLingInfoDict[zhanLingType].freeZhanHaveDict == null || !FuncOpen.Instance.IsFuncOpen(217))
|
| | | return;
|
| | | var needValueList = zhanLingInfoDict[zhanLingType].freeZhanHaveDict.Keys.ToList();
|
| | | for (int i = 0; i < zhanLingInfoDict[zhanLingType].freeZhanHaveDict.Count; i++)
|
| | | {
|
| | | if (GetGiftState(zhanLingType, needValueList[i], true) == 1 || GetGiftState(zhanLingType, needValueList[i], false) == 1)
|
| | | {
|
| | | redpoint.state = RedPointState.Simple;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | //已经购买并领取所有物品
|
| | | public bool IsFinish()
|
| | | {
|
| | | if (zhanLingInfoDict.IsNullOrEmpty() || !zhanLingInfoDict.TryGetValue(ZhanLingType, out var zhanlingInfo) ||
|
| | | zhanlingInfo == null || zhanlingInfo.freeZhanHaveDict == null || zhanlingInfo.paidZhanHaveDict == null)
|
| | | return false;
|
| | | //有没购买的
|
| | | if (zhanlingInfo.isActivite == 0)
|
| | | return false;
|
| | | //有没领取的物品
|
| | | var arr = zhanlingInfo.freeZhanHaveDict.Keys.ToArray();
|
| | | for (int i = 0; i < arr.Length; i++)
|
| | | {
|
| | | int needValue = arr[i];
|
| | | if (!IsHaveZhanLingGift(ZhanLingType, needValue, false) || !IsHaveZhanLingGift(ZhanLingType, needValue, true))
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | | }
|
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d840fd1442bd70941a7d6ad2119de3dd |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | // 仙缘战令
|
| | | public class FairyAffinityZhanLingWin : Window
|
| | | {
|
| | | [SerializeField] ScrollerController scroller;
|
| | | [SerializeField] TextEx txtBuy;
|
| | | [SerializeField] TextEx txtProfitRatio;
|
| | | [SerializeField] TextEx txtBuyValue;
|
| | | [SerializeField] ButtonEx btnBuy;
|
| | | [SerializeField] ImageEx imgBuy;
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
| | | FairyAffinityZhanLingModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityZhanLingModel>(); } }
|
| | |
|
| | | #region Built-in
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | btnBuy.SetListener(() =>
|
| | | {
|
| | | vipModel.CTG(model.ctgIdDict[model.ZhanLingType]);
|
| | | });
|
| | | }
|
| | |
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | PlayerDatas.Instance.playerDataRefreshEvent += OnplayerDataRefreshEvent;
|
| | | model.UpdateGiftStateEvent += UpdateGiftStateEvent;
|
| | | scroller.OnRefreshCell += OnScrollerRefreshCell;
|
| | |
|
| | | bool isBuyZhanLing = model.IsBuy();
|
| | | btnBuy.SetActiveIL(!isBuyZhanLing);
|
| | | imgBuy.SetActiveIL(isBuyZhanLing);
|
| | | OrderInfoConfig orderCfg;
|
| | | vipModel.TryGetOrderInfo(model.ctgIdDict[model.ZhanLingType], out orderCfg);
|
| | | txtBuy.text = Language.Get("PayMoneyNum", orderCfg.PayRMBNum);
|
| | | txtProfitRatio.text = Language.Get("BlessedLand039", CTGConfig.Get(model.ctgIdDict[model.ZhanLingType]).Percentage);
|
| | | txtBuyValue.text = model.buyValue.ToString();
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | PlayerDatas.Instance.playerDataRefreshEvent -= OnplayerDataRefreshEvent;
|
| | | model.UpdateGiftStateEvent -= UpdateGiftStateEvent;
|
| | | scroller.OnRefreshCell -= OnScrollerRefreshCell;
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | Initialize();
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | private void OnplayerDataRefreshEvent(PlayerDataType type)
|
| | | {
|
| | | if (type == PlayerDataType.default42)
|
| | | {
|
| | | if (model.zhanLingInfoDict == null || !model.zhanLingInfoDict.ContainsKey(model.ZhanLingType))
|
| | | return;
|
| | |
|
| | | scroller.m_Scorller.RefreshActiveCellViews();
|
| | | model.IsPlayAnimation = true;
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateGiftStateEvent()
|
| | | {
|
| | | scroller.m_Scorller.RefreshActiveCellViews();
|
| | | bool isBuyZhanLing = model.IsBuy();
|
| | | btnBuy.SetActiveIL(!isBuyZhanLing);
|
| | | imgBuy.SetActiveIL(isBuyZhanLing);
|
| | | model.IsPlayAnimation = true;
|
| | | }
|
| | |
|
| | | private void OnScrollerRefreshCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | var _cell = cell as FairyAffinityZhanLingCell;
|
| | | _cell.Display(_cell.index);
|
| | | model.IsPlayAnimation = true;
|
| | | }
|
| | |
|
| | | private void Initialize()
|
| | | {
|
| | | List<int> cellList = ILZhanlingConfig.GetTypeToIDDict(model.ZhanLingType).Keys.ToList();
|
| | | scroller.Refresh();
|
| | | for (int i = 0; i < cellList.Count; i++)
|
| | | {
|
| | | scroller.AddCell(ScrollerDataType.Header, cellList[i]);
|
| | | }
|
| | | scroller.Restart();
|
| | | scroller.JumpIndex(model.GetJumpStartIndex(model.ZhanLingType));
|
| | | model.IsPlayAnimation = true;
|
| | | }
|
| | | }
|
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1e090cd265005784ea61c74ad418700a |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | [SerializeField] Button m_mr648;
|
| | | [SerializeField] Button m_Vourcher100;
|
| | | [SerializeField] Button m_ForeverCard;
|
| | | [SerializeField] Button m_XY;
|
| | |
|
| | | private bool isNeedTip = true;
|
| | |
|
| | |
| | | m_mr648.SetListener(() => { WindowCenter.Instance.Open<LoginAwardWin>(); });
|
| | | m_Vourcher100.SetListener(() => { WindowCenter.Instance.Open<Vourcher100Win>(); });
|
| | | m_ForeverCard.SetListener(() => { WindowCenter.Instance.Open<ForeverCardWin>(); });
|
| | | m_XY.SetListener(() => { WindowCenter.Instance.Open<FairyAffinityWin>(); });
|
| | | }
|
| | |
|
| | | public void Init()
|
| | |
| | | storeModel.StoreFuncOpenAct += OnStoreFuncOpen;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange += OpenServerActivityStateChange;
|
| | | m_JPBN.SetActive(NeedForWhiteModel.Instance.IsOpen());
|
| | | m_XY.SetActive(ModelCenter.Instance.GetModel<FairyAffinityLoginActModel>().IsOpen);
|
| | | ShowNewActionButton();
|
| | | }
|
| | |
|
| | |
| | | public const int CelestialPalaceRepoint = 458; //仙宫
|
| | | public const int PhantasmPavilionRepoint = 459; //幻境阁
|
| | | public const int PhantasmPavilionZhanLingRepoint = 460; //幻境战令
|
| | |
|
| | | public const int FairyAffinityRepoint = 461; //仙缘
|
| | | public const int RedPoint_MR648 = 900; // BT功能红点 - 每日648
|
| | |
|
| | |
|
| | |
| | | public const int activityID = (int)NewDayActivityID.LoginAct; |
| | | public static Operation operaType = Operation.default29; |
| | | |
| | | public int actNum; //对应界面 |
| | | public int actNum = 30; //对应界面 |
| | | public event Action UpdateyLoginEvent; |
| | | |
| | | public override void Init() |
| | |
| | | |
| | | public void UpdateLoginInfo(HAA70_tagMCActLoginPlayerInfoNew netPack) |
| | | { |
| | | actNum = netPack.ActNum; |
| | | if (actNum != netPack.ActNum)
|
| | | return; |
| | | LoginAwardState = netPack.LoginAward; |
| | | UpdateyLoginEvent?.Invoke(); |
| | | |
| | |
| | | |
| | | public void UpdateMissionPlayerInfo(HAA73_tagMCActTaskPlayerInfo netPack) |
| | | { |
| | | if (netPack.ActNum != 30)
|
| | | return; |
| | | actNum = netPack.ActNum; |
| | | AwardRecordList = netPack.AwardRecordList; |
| | | bool isNewRound = false; |
| | |
| | | |
| | | public void UpdateMissionPlayerValueInfo(HAA72_tagMCActTaskPlayerValueInfo netPack)
|
| | | { |
| | | if (netPack.ActNum != 30)
|
| | | return; |
| | | actNum = netPack.ActNum; |
| | | |
| | | for (int i = 0; i < netPack.TaskValueList.Length; i++) |
| | |
| | | public List<HAA69_tagMCActLoginNew.tagMCActLoginNewDay> loginAwards = new List<HAA69_tagMCActLoginNew.tagMCActLoginNewDay>(); |
| | | public int costType; // 补签消耗货币类型 |
| | | public int costValue; // 补签消耗货币值 |
| | | public int awardExCTGID; // 扩展奖励礼包充值ID,大于0时代表可以购买礼包每日登录可领取额外奖励 |
| | | public override bool SatisfyOpenCondition() |
| | | { |
| | | return PlayerDatas.Instance.baseData.LV >= limitLv; |
| | |
| | | } |
| | | costType = package.RepSignMoneyType; |
| | | costValue = (int)package.RepSignMoneyValue; |
| | | awardExCTGID = (int)package.AwardExCTGID; |
| | | } |
| | | } |
| | | } |
| | |
| | | public void UpdateLoginAct(HAA69_tagMCActLoginNew package)
|
| | | {
|
| | | OperationBase operationBase = null;
|
| | | operationDict.TryGetValue(Operation.default29, out operationBase);
|
| | | Operation operationType = Operation.default29;
|
| | |
|
| | | switch (package.ActNum)
|
| | | {
|
| | | case 11:
|
| | | operationType = Operation.default44;
|
| | | break;
|
| | | case 30:
|
| | | operationType = Operation.default29;
|
| | | break;
|
| | | }
|
| | |
|
| | | operationDict.TryGetValue(operationType, out operationBase);
|
| | | if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
|
| | | {
|
| | | ForceStopOperation(Operation.default29);
|
| | | ForceStopOperation(operationType);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (operationBase == null)
|
| | | {
|
| | | operationBase = new OperationLoginAct();
|
| | | operationDict.Add(Operation.default29, operationBase);
|
| | | operationDict.Add(operationType, operationBase);
|
| | | }
|
| | | var operation = operationBase as OperationLoginAct;
|
| | | operation.Reset();
|
| | |
| | | operation.ParsePackage(package);
|
| | | if (operationTimeUpdateEvent != null)
|
| | | {
|
| | | operationTimeUpdateEvent(Operation.default29);
|
| | | operationTimeUpdateEvent(operationType);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | OperationBase operationBase = null;
|
| | |
|
| | | var opreationType = Operation.default30;
|
| | |
|
| | | switch (package.ActNum)
|
| | | {
|
| | | case 11:
|
| | | opreationType = Operation.default45;
|
| | | break;
|
| | | case 30:
|
| | | opreationType = Operation.default30;
|
| | | break;
|
| | | }
|
| | | operationDict.TryGetValue(opreationType, out operationBase);
|
| | |
|
| | | if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
|
| | |
| | | break;
|
| | | case 31:
|
| | | operationType = Operation.default38;
|
| | | break;
|
| | | case 11:
|
| | | operationType = Operation.default46;
|
| | | break;
|
| | | default:
|
| | | return;
|
| | |
| | | default41, //日期型活动- 古宝养成本服
|
| | | default42, //日期型活动- 古宝养成跨服
|
| | | default43, ////日期型活动- 任务环
|
| | | default44,
|
| | | default45,
|
| | | default46,
|
| | | default44, //日期型活动 - 仙缘登陆,可补签
|
| | | default45, //日期型活动 - 仙缘任务
|
| | | default46, //日期型活动 - 仙缘礼包
|
| | | default47,
|
| | | default48,
|
| | | default49,
|
| | |
| | | RegisterModel<FairyEmblemModel>();
|
| | | RegisterModel<PhantasmPavilionModel>();
|
| | | RegisterModel<PhantasmPavilionZhanLingModel>();
|
| | | RegisterModel<FairyAffinityModel>();
|
| | | RegisterModel<FairyAffinityZhanLingModel>();
|
| | | RegisterModel<FairyAffinityLoginActModel>();
|
| | | RegisterModel<FairyAffinityMissionActModel>();
|
| | | RegisterModel<FairyAffinityRechargeGiftActModel>();
|
| | | inited = true;
|
| | | }
|
| | |
|
| | |
| | | default39, // 267 天道币
|
| | | default40,
|
| | | default41, // 269 过期型代金券
|
| | | default42,
|
| | | default42, // 270 仙缘积分
|
| | | default43, // 271 幻境阁积分
|
| | | default44,
|
| | | default45,
|
| | |
| | | PetHorseActCross = 211, //宠物坐骑活动 跨服
|
| | | TreasurePavilionAct = 212, //古宝活动
|
| | | TreasurePavilionActCross = 213, //古宝活动 跨服
|
| | | FairyAffinityLoginAct = 214, //仙缘登陆活动
|
| | | FairyAffinityMissionAct = 215, //仙缘任务活动
|
| | | FairyAffinityRechargeGiftAct = 216, //仙缘礼包活动
|
| | |
|
| | | }
|
| | |
|
| | |
| | | //天道币
|
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default39);
|
| | | }
|
| | | case 49:
|
| | | {
|
| | | //仙缘积分
|
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default42);
|
| | | }
|
| | | case 50:
|
| | | {
|
| | | //幻境阁积分
|