Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| | |
| | | Register(typeof(HA318_tagMCFreeGoodsInfo), typeof(DTCA318_tagMCFreeGoodsInfo));
|
| | | Register(typeof(HAA12_tagMCFlashGiftbagInfo), typeof(DTCAA12_tagMCFlashGiftbagInfo));
|
| | | Register(typeof(HAA13_tagMCFlashGiftbagPlayerInfo), typeof(DTCAA13_tagMCFlashGiftbagPlayerInfo));
|
| | | Register(typeof(HAA17_tagMCFlashSaleInfo), typeof(DTCAA17_tagMCFlashSaleInfo));
|
| | | Register(typeof(HAA18_tagMCFlashSaleAppointmentInfo), typeof(DTCAA18_tagMCFlashSaleAppointmentInfo));
|
| | |
|
| | | #region 仙界盛典
|
| | | Register(typeof(HAC09_tagGCFairyCeremonyInfo), typeof(DTCAC09_tagGCFairyCeremonyInfo));
|
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // AA 05 限时抢购预约 #tagCMFlashSaleAppointment
|
| | |
|
| | | public class CAA05_tagCMFlashSaleAppointment : GameNetPackBasic {
|
| | | public uint GoodsID; // 抢购商品标识
|
| | | public byte State; // 1-预约 0-取消
|
| | |
|
| | | public CAA05_tagCMFlashSaleAppointment () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xAA05;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (GoodsID, NetDataType.DWORD);
|
| | | WriteBytes (State, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0bd4980ed38baa24e8d85722181ec836 |
| | | timeCreated: 1539228128 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 722e5e3d30096674e811f5bd191246a0 |
| | | folderAsset: yes |
| | | timeCreated: 1539228128 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a75d33f87d2bafb4191666d4978b2e08 |
| | | folderAsset: yes |
| | | timeCreated: 1539228128 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | { |
| | | base.Done(vNetPack); |
| | | var data = vNetPack as HA003_tagUniversalGameRecInfo; |
| | | heavenModel.RefreshBattleInfo(data);
|
| | | if (onGetUniversalGameInfo != null) |
| | | { |
| | | onGetUniversalGameInfo(data); |
| | | } |
| | | |
| | | heavenModel.RefreshBattleInfo(data); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using Snxxz.UI;
|
| | |
|
| | | // AA 17 限时抢购活动信息 #tagMCFlashSaleInfo
|
| | |
|
| | |
|
| | |
|
| | | public class DTCAA17_tagMCFlashSaleInfo : DtcBasic {
|
| | |
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | |
|
| | | base.Done(vNetPack);
|
| | |
|
| | | HAA17_tagMCFlashSaleInfo vNetData = vNetPack as HAA17_tagMCFlashSaleInfo;
|
| | | OperationTimeHepler.Instance.UpdateFlashRushToBuy(vNetData);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d00087bdecd7d4947a5c1f5e6d0e98a3 |
| | | timeCreated: 1539228128 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using Snxxz.UI;
|
| | | // AA 18 限时抢购活动玩家预约信息 #tagMCFlashSaleAppointmentInfo
|
| | |
|
| | |
|
| | |
|
| | | public class DTCAA18_tagMCFlashSaleAppointmentInfo : DtcBasic
|
| | | {
|
| | |
|
| | | FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
| | | public override void Done(GameNetPackBasic vNetPack)
|
| | | {
|
| | |
|
| | | base.Done(vNetPack);
|
| | |
|
| | | HAA18_tagMCFlashSaleAppointmentInfo vNetData = vNetPack as HAA18_tagMCFlashSaleAppointmentInfo;
|
| | | rushToBuyModel.UpdateFlashSaleAppointmentInfo(vNetData);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 32d6f801e94f8b84086c12c4672b5dcf |
| | | timeCreated: 1539228128 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // AA 17 限时抢购活动信息 #tagMCFlashSaleInfo
|
| | |
|
| | | public class HAA17_tagMCFlashSaleInfo : GameNetPackBasic {
|
| | | public string StartDate; // 开始日期 y-m-d
|
| | | public string EndtDate; // 结束日期 y-m-d
|
| | | public ushort AdvanceMinutes; // 提前显示分钟
|
| | | public byte ActivityTimeCount;
|
| | | public tagMCFlashSaleTime[] ActivityTime; //活动时间
|
| | | public byte IsDayReset; //是否每天重置
|
| | | public ushort LimitLV; // 限制等级
|
| | | public byte ShopCount; // 商店数
|
| | | public tagMCFlashSaleShop[] ShopInfo; // 商店信息, 当有多个商店且有多个活动时间段时则每个时间段对应一个商店;
|
| | |
|
| | | public HAA17_tagMCFlashSaleInfo () {
|
| | | _cmd = (ushort)0xAA17;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out StartDate, vBytes, NetDataType.Chars, 10);
|
| | | TransBytes (out EndtDate, vBytes, NetDataType.Chars, 10);
|
| | | TransBytes (out AdvanceMinutes, vBytes, NetDataType.WORD);
|
| | | TransBytes (out ActivityTimeCount, vBytes, NetDataType.BYTE);
|
| | | ActivityTime = new tagMCFlashSaleTime[ActivityTimeCount];
|
| | | for (int i = 0; i < ActivityTimeCount; i ++) {
|
| | | ActivityTime[i] = new tagMCFlashSaleTime();
|
| | | TransBytes (out ActivityTime[i].StartTime, vBytes, NetDataType.Chars, 5);
|
| | | TransBytes (out ActivityTime[i].EndtTime, vBytes, NetDataType.Chars, 5);
|
| | | }
|
| | | TransBytes (out IsDayReset, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out LimitLV, vBytes, NetDataType.WORD);
|
| | | TransBytes (out ShopCount, vBytes, NetDataType.BYTE);
|
| | | ShopInfo = new tagMCFlashSaleShop[ShopCount];
|
| | | for (int i = 0; i < ShopCount; i ++) {
|
| | | ShopInfo[i] = new tagMCFlashSaleShop();
|
| | | TransBytes (out ShopInfo[i].DayIndex, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out ShopInfo[i].TimeIndex, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out ShopInfo[i].GiftbagCount, vBytes, NetDataType.BYTE);
|
| | | ShopInfo[i].GiftbagInfo = new tagMCFlashSaleGiftbag[ShopInfo[i].GiftbagCount];
|
| | | for (int j = 0; j < ShopInfo[i].GiftbagCount; j ++) {
|
| | | ShopInfo[i].GiftbagInfo[j] = new tagMCFlashSaleGiftbag();
|
| | | TransBytes (out ShopInfo[i].GiftbagInfo[j].GiftID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out ShopInfo[i].GiftbagInfo[j].BuyCountLimit, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out ShopInfo[i].GiftbagInfo[j].ServerBuyCountLimit, vBytes, NetDataType.WORD);
|
| | | TransBytes (out ShopInfo[i].GiftbagInfo[j].MoneyType, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out ShopInfo[i].GiftbagInfo[j].MoneyNumber, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out ShopInfo[i].GiftbagInfo[j].MoneyOriginal, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out ShopInfo[i].GiftbagInfo[j].ItemID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out ShopInfo[i].GiftbagInfo[j].ItemCount, vBytes, NetDataType.WORD);
|
| | | TransBytes (out ShopInfo[i].GiftbagInfo[j].IsBind, vBytes, NetDataType.BYTE);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public struct tagMCFlashSaleGiftbag {
|
| | | public uint GiftID; //商城表的物品ID
|
| | | public byte BuyCountLimit; //限购数
|
| | | public ushort ServerBuyCountLimit; //全服限购数
|
| | | public byte MoneyType; //消耗货币类型
|
| | | public uint MoneyNumber; //消耗货币数量
|
| | | public uint MoneyOriginal; //原价
|
| | | public uint ItemID;
|
| | | public ushort ItemCount;
|
| | | public byte IsBind;
|
| | | }
|
| | |
|
| | | public struct tagMCFlashSaleShop {
|
| | | public byte DayIndex; // 活动第几天
|
| | | public byte TimeIndex; // 第几个时间段
|
| | | public byte GiftbagCount; // 商店礼包数
|
| | | public tagMCFlashSaleGiftbag[] GiftbagInfo; // 礼包信息
|
| | | }
|
| | |
|
| | | public struct tagMCFlashSaleTime {
|
| | | public string StartTime; // 开始时间 H:M
|
| | | public string EndtTime; // 结束时间 H:M
|
| | | }
|
| | |
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ed9668281d90fdc4f97232ce3fcd3c9d |
| | | timeCreated: 1539228128 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // AA 18 限时抢购活动玩家预约信息 #tagMCFlashSaleAppointmentInfo
|
| | |
|
| | | public class HAA18_tagMCFlashSaleAppointmentInfo : GameNetPackBasic {
|
| | | public byte IsAll; // 是否全部
|
| | | public ushort GoodsCount; // 商品数
|
| | | public tagMCFlashSaleAppointmentState[] GoodsList; // 预约的商品
|
| | |
|
| | | public HAA18_tagMCFlashSaleAppointmentInfo () {
|
| | | _cmd = (ushort)0xAA18;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out IsAll, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out GoodsCount, vBytes, NetDataType.WORD);
|
| | | GoodsList = new tagMCFlashSaleAppointmentState[GoodsCount];
|
| | | for (int i = 0; i < GoodsCount; i ++) {
|
| | | GoodsList[i] = new tagMCFlashSaleAppointmentState();
|
| | | TransBytes (out GoodsList[i].GoodsMark, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out GoodsList[i].State, vBytes, NetDataType.BYTE);
|
| | | }
|
| | | }
|
| | |
|
| | | public struct tagMCFlashSaleAppointmentState {
|
| | | public uint GoodsMark; // 商品标识
|
| | | public byte State; // 是否预约
|
| | | }
|
| | |
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 44e6594130c5e614c8411949a184b843 |
| | | timeCreated: 1539228128 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | {
|
| | | OnClickSendBtn();
|
| | | }
|
| | |
|
| | | //if(Input.GetKeyDown(KeyCode.J))
|
| | | //{
|
| | | // EquipWashModel washModel = ModelCenter.Instance.GetModel<EquipWashModel>();
|
| | | // LocalSave.SetBool(washModel.MasterGroup1ActiveKey, false);
|
| | | // washModel.SetMasterGroupActiveRecord(2,1, washModel.MasterGroup1ActiveKey);
|
| | | // WindowCenter.Instance.Open<WashMasterActiveWin>();
|
| | | //}
|
| | |
|
| | | //if (Input.GetKeyDown(KeyCode.O))
|
| | | //{
|
| | | // EquipWashModel washModel = ModelCenter.Instance.GetModel<EquipWashModel>();
|
| | | // LocalSave.SetInt(washModel.MasterGroup1RaiseKey, 2);
|
| | | // washModel.SetMasterGroupRaiseRecord(4, 1, washModel.MasterGroup1RaiseKey);
|
| | | // WindowCenter.Instance.Open<WashMasterActiveWin>();
|
| | | //}
|
| | | }
|
| | |
|
| | | private void CreateCmdCell()
|
| | |
| | | {
|
| | | [SerializeField] UIAlphaTween m_AlphaTween;
|
| | | [SerializeField] Image m_BackGround;
|
| | | [SerializeField] RectTransform m_AndroidProgressContainer;
|
| | | [SerializeField] SmoothSlider m_ProgressSlider;
|
| | | [SerializeField] Text m_Progress;
|
| | | [SerializeField] RectTransform m_IosProgressContainer;
|
| | | [SerializeField] Text m_IosProgressTip;
|
| | | [SerializeField] Text m_BuildTime;
|
| | | [SerializeField] Text m_Version;
|
| | |
|
| | |
| | | m_BuildTime.text = "";
|
| | | }
|
| | |
|
| | | m_Progress.text = VersionUtility.Instance.IsShangGu() ? "" : StringUtility.Contact(0, "%");
|
| | |
|
| | | UpdateLoadingProgress(Launch.currentStage, Launch.progress);
|
| | |
|
| | | Launch.progressEvent += UpdateLoadingProgress;
|
| | | if (Application.platform == RuntimePlatform.IPhonePlayer)
|
| | | {
|
| | | m_AndroidProgressContainer.gameObject.SetActive(false);
|
| | | m_IosProgressContainer.gameObject.SetActive(true);
|
| | | m_IosProgressTip.text = Language.GetFromLocal(30);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_AndroidProgressContainer.gameObject.SetActive(true);
|
| | | m_IosProgressContainer.gameObject.SetActive(false);
|
| | | m_Progress.text = VersionUtility.Instance.IsShangGu() ? "" : StringUtility.Contact(0, "%");
|
| | | UpdateLoadingProgress(Launch.currentStage, Launch.progress);
|
| | | Launch.progressEvent += UpdateLoadingProgress;
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | | {
|
| | | base.LateUpdate();
|
| | |
|
| | | if (trueProgress > 0.9599f)
|
| | | if (Application.platform == RuntimePlatform.IPhonePlayer)
|
| | | {
|
| | | behaviourProgress = Mathf.Clamp01(behaviourProgress + Time.deltaTime * 0.2f);
|
| | | m_IosProgressContainer.gameObject.SetActive(Launch.currentStage != Launch.LaunchStage.DownLoad);
|
| | | var remainder = ((int)Time.time) % 3;
|
| | | var dot = remainder == 0 ? "." : remainder == 1 ? ".." : "...";
|
| | | m_IosProgressTip.text = StringUtility.Contact(Language.GetFromLocal(30), dot);
|
| | | }
|
| | | else
|
| | | {
|
| | | behaviourProgress = Mathf.SmoothDamp(behaviourProgress, trueProgress, ref refProgress, 0.2f);
|
| | | if (trueProgress > 0.9599f)
|
| | | {
|
| | | behaviourProgress = Mathf.Clamp01(behaviourProgress + Time.deltaTime * 0.2f);
|
| | | }
|
| | | else
|
| | | {
|
| | | behaviourProgress = Mathf.SmoothDamp(behaviourProgress, trueProgress, ref refProgress, 0.2f);
|
| | | }
|
| | |
|
| | | m_ProgressSlider.value = behaviourProgress;
|
| | | m_Progress.text = VersionUtility.Instance.IsShangGu() ? stepDescription :
|
| | | StringUtility.Contact(stepDescription, Mathf.RoundToInt(behaviourProgress * 100), "%");
|
| | |
|
| | | if (!assetBuildTimeShowed && AssetVersionUtility.assetsBuildTime != DateTime.MinValue)
|
| | | {
|
| | | assetBuildTimeShowed = true;
|
| | | var totalMinute = (int)(AssetVersionUtility.assetsBuildTime - new DateTime(2018, 1, 1)).TotalMinutes;
|
| | | m_Version.text = StringUtility.Contact(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex, "_", totalMinute.ToString());
|
| | | }
|
| | | }
|
| | |
|
| | | m_ProgressSlider.value = behaviourProgress;
|
| | | m_Progress.text = VersionUtility.Instance.IsShangGu() ? stepDescription :
|
| | | StringUtility.Contact(stepDescription, Mathf.RoundToInt(behaviourProgress * 100), "%");
|
| | |
|
| | | if (!assetBuildTimeShowed && AssetVersionUtility.assetsBuildTime != DateTime.MinValue)
|
| | | {
|
| | | assetBuildTimeShowed = true;
|
| | | var totalMinute = (int)(AssetVersionUtility.assetsBuildTime - new DateTime(2018, 1, 1)).TotalMinutes;
|
| | | m_Version.text = StringUtility.Contact(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex, "_", totalMinute.ToString());
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| New file |
| | |
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class FlashRushToBuyCoolDown : MonoBehaviour
|
| | | {
|
| | | [SerializeField] Text timeText;
|
| | | FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
| | | bool isReplace = false;
|
| | | bool isStartReplace = false;
|
| | | private void Awake()
|
| | | {
|
| | | GlobalTimeEvent.Instance.halfMinuteEvent += UpdateHalfMinute;
|
| | | }
|
| | |
|
| | | private void OnEnable()
|
| | | {
|
| | | SecondEvent();
|
| | | GlobalTimeEvent.Instance.secondEvent -= SecondEvent;
|
| | | GlobalTimeEvent.Instance.secondEvent += SecondEvent;
|
| | | }
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | GlobalTimeEvent.Instance.secondEvent -= SecondEvent;
|
| | | }
|
| | |
|
| | | private void UpdateHalfMinute()
|
| | | {
|
| | | if (!isStartReplace) return;
|
| | |
|
| | | isReplace = !isReplace;
|
| | | }
|
| | |
|
| | | private void SecondEvent()
|
| | | {
|
| | | DisplayTime();
|
| | | }
|
| | |
|
| | | void DisplayTime()
|
| | | {
|
| | | var operation = rushToBuyModel.GetOperationFlashRushToBuy();
|
| | | if (operation == null) return;
|
| | | int seconds = 0;
|
| | | OperationTime operationTime;
|
| | | OperationFlashRushToBuy.FlashSaleShop saleShop;
|
| | | FlashRushToBuyModel.FlashRushToBuySate flashState = rushToBuyModel.GetActivityState(out seconds,out operationTime,out saleShop);
|
| | | isStartReplace = false;
|
| | | switch (flashState)
|
| | | {
|
| | | case FlashRushToBuyModel.FlashRushToBuySate.NoOpen:
|
| | | break;
|
| | | case FlashRushToBuyModel.FlashRushToBuySate.InAdvance:
|
| | | if(seconds <= 3600)
|
| | | {
|
| | | isStartReplace = true;
|
| | | if(!isReplace)
|
| | | {
|
| | | timeText.text = TimeUtility.SecondsToHMS(seconds);
|
| | | }
|
| | | else
|
| | | {
|
| | | timeText.text = operation.ToDisplayBuyTime(operationTime.startHour, operationTime.startMinute);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | timeText.text = operation.ToDisplayBuyTime(operationTime.startHour, operationTime.startMinute);
|
| | | }
|
| | | break;
|
| | | case FlashRushToBuyModel.FlashRushToBuySate.Begining:
|
| | | timeText.text = "秒杀中";
|
| | | break;
|
| | | case FlashRushToBuyModel.FlashRushToBuySate.End:
|
| | | timeText.text = "活动已结束";
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 00bbdfc8d38efc7488d8dc83b041b07a |
| | | timeCreated: 1539088207 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using System.Text;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class FlashRushToBuyModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk,IOpenServerActivity
|
| | | {
|
| | | StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
|
| | | HeavenBattleModel battleModel { get { return ModelCenter.Instance.GetModel<HeavenBattleModel>(); } }
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
|
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
|
| | | OperationTimeHepler.Instance.operationAdvanceEvent += OperationAdvanceEvent;
|
| | | TimeMgr.Instance.OnDayEvent += OnDayEvent;
|
| | | OpenServerActivityCenter.Instance.Register(4, this);
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | if(!WindowCenter.Instance.IsOpen<OpenServerActivityNotifyWin>())
|
| | | {
|
| | | WindowCenter.Instance.Open<OpenServerActivityNotifyWin>();
|
| | | }
|
| | | //UpdateRedpoint();
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
|
| | | OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
|
| | | OperationTimeHepler.Instance.operationAdvanceEvent -= OperationAdvanceEvent;
|
| | | TimeMgr.Instance.OnDayEvent -= OnDayEvent;
|
| | | }
|
| | |
|
| | | public bool IsOpen
|
| | | {
|
| | | get
|
| | | {
|
| | | var operation = GetOperationFlashRushToBuy();
|
| | | if(operation != null)
|
| | | {
|
| | | return operation.SatisfyOpenCondition();
|
| | | }
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | public bool priorityOpen
|
| | | {
|
| | | get
|
| | | {
|
| | | return flashSaleRedpoint.state == RedPointState.Simple;
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsAdvance
|
| | | {
|
| | | get
|
| | | {
|
| | | return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.FlashRushToBuy);
|
| | | }
|
| | | }
|
| | |
|
| | | public void SetDefaultSelectSaleTime()
|
| | | {
|
| | | OperationFlashRushToBuy operation = GetOperationFlashRushToBuy();
|
| | | if (presentFlashShop != null)
|
| | | {
|
| | | int seconds = 0;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,presentFlashShop.dayIndex,presentFlashShop.timeIndex, out seconds);
|
| | | if(buyState != 1)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < operation.flashShops.Count; i++)
|
| | | {
|
| | | int days = operation.totalDays + 1;
|
| | | int dayIndex = i / (operation.flashShops.Count / days);
|
| | | int timeIndex = i % (operation.flashShops.Count / days);
|
| | | int seconds = 0;
|
| | | OperationTime operationTime = operation.times[timeIndex];
|
| | | var date = operation.startDate;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, dayIndex, timeIndex, out seconds);
|
| | | switch(buyState)
|
| | | {
|
| | | case -1:
|
| | | case 0:
|
| | | UpdateSelectFlashSaleTime(dayIndex,timeIndex);
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void ResetFlashShop()
|
| | | {
|
| | | presentFlashShop = null;
|
| | | }
|
| | |
|
| | | #region 本地数据处理
|
| | | public OperationFlashRushToBuy.FlashSaleShop presentFlashShop { get; private set; }
|
| | | public event Action UpdateSelectSaleTimeEvent;
|
| | | public void UpdateSelectFlashSaleTime(int dayIndex,int timeIndex)
|
| | | {
|
| | | presentFlashShop = null;
|
| | | OperationFlashRushToBuy operation = GetOperationFlashRushToBuy();
|
| | | if(operation != null)
|
| | | {
|
| | | OperationFlashRushToBuy.FlashSaleShop flashShop;
|
| | | operation.TryGetFlashShop(dayIndex, timeIndex, out flashShop);
|
| | | presentFlashShop = flashShop;
|
| | | if(UpdateSelectSaleTimeEvent != null)
|
| | | {
|
| | | UpdateSelectSaleTimeEvent();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public OperationFlashRushToBuy GetOperationFlashRushToBuy()
|
| | | {
|
| | | OperationBase operationBase;
|
| | | if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashRushToBuy, out operationBase))
|
| | | {
|
| | | return operationBase as OperationFlashRushToBuy;
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 协议
|
| | | public event Action UpdateAllAppointmentEvent;
|
| | | public event Action<int> UpdateAppointmentEvent;
|
| | | public void UpdateFlashSaleAppointmentInfo(HAA18_tagMCFlashSaleAppointmentInfo appointmentInfo)
|
| | | {
|
| | | var operation = GetOperationFlashRushToBuy();
|
| | | if (operation == null) return;
|
| | |
|
| | | if (appointmentInfo.IsAll == 1)
|
| | | {
|
| | | for (int j = 0; j < operation.flashShops.Count; j++)
|
| | | {
|
| | | var saleItems = operation.flashShops[j].items;
|
| | | for (int k = 0; k < saleItems.Length; k++)
|
| | | {
|
| | | saleItems[k].isAppointment = 0;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < appointmentInfo.GoodsCount; i++)
|
| | | {
|
| | | var saleItemInfo = appointmentInfo.GoodsList[i];
|
| | | for (int j = 0; j < operation.flashShops.Count; j++)
|
| | | {
|
| | | var saleItems = operation.flashShops[j].items;
|
| | | for (int k = 0; k < saleItems.Length; k++)
|
| | | {
|
| | | if (saleItems[k].shopGuid == saleItemInfo.GoodsMark)
|
| | | {
|
| | | if(saleItems[k].isAppointment != saleItemInfo.State)
|
| | | {
|
| | | saleItems[k].isAppointment = saleItemInfo.State;
|
| | | if(UpdateAppointmentEvent != null)
|
| | | {
|
| | | UpdateAppointmentEvent((int)saleItemInfo.GoodsMark);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | if(appointmentInfo.IsAll == 1)
|
| | | {
|
| | | if (UpdateAllAppointmentEvent != null)
|
| | | {
|
| | | UpdateAllAppointmentEvent();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | /// <summary>
|
| | | /// Value1 商品ID Value2 全服购买次数
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public GameRecInfo GetFullServerInfo()
|
| | | {
|
| | | var infolist = battleModel.GetBatterInfoListByType(8);
|
| | | if(infolist != null && infolist.Count > 0)
|
| | | {
|
| | | return infolist[0];
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 限时抢购预约
|
| | | /// </summary>
|
| | | public void SendFlashSaleAppointment(int shopGuid,int state)
|
| | | {
|
| | | CAA05_tagCMFlashSaleAppointment appointment = new CAA05_tagCMFlashSaleAppointment();
|
| | | appointment.GoodsID = (uint)shopGuid;
|
| | | appointment.State = (byte)state;
|
| | | GameNetSystem.Instance.SendInfo(appointment);
|
| | | }
|
| | | #endregion
|
| | |
|
| | | /// <summary>
|
| | | /// 获得限时抢购活动状态
|
| | | /// </summary>
|
| | | /// <param name="seconds"></param>
|
| | | /// <returns></returns>
|
| | | public FlashRushToBuySate GetActivityState(out int seconds,out OperationTime operationTime,out OperationFlashRushToBuy.FlashSaleShop saleShop)
|
| | | {
|
| | | seconds = 0;
|
| | | saleShop = null;
|
| | | operationTime = default(OperationTime);
|
| | | var operation = GetOperationFlashRushToBuy();
|
| | | if (!IsOpen || operation == null) return FlashRushToBuySate.NoOpen;
|
| | |
|
| | | int openState = 0;
|
| | | int endState = 0;
|
| | | int openSeconds = 0;
|
| | | int endSeconds = 0;
|
| | | for(int i = 0; i < operation.flashShops.Count;i++)
|
| | | {
|
| | | OperationFlashRushToBuy.FlashSaleShop openSaleShop = operation.flashShops[i];
|
| | | operationTime = operation.times[openSaleShop.timeIndex];
|
| | | openState = operation.GetBuyTimeState(TimeUtility.ServerNow, openSaleShop.dayIndex, openSaleShop.timeIndex, out openSeconds);
|
| | | if(openState != 1)
|
| | | {
|
| | | saleShop = openSaleShop;
|
| | | break;
|
| | | }
|
| | | }
|
| | | if(operation.flashShops.Count > 0)
|
| | | {
|
| | | OperationFlashRushToBuy.FlashSaleShop endSaleShop = operation.flashShops[operation.flashShops.Count - 1];
|
| | | endState = operation.GetBuyTimeState(TimeUtility.ServerNow, endSaleShop.dayIndex, endSaleShop.timeIndex, out endSeconds);
|
| | | }
|
| | | |
| | | switch(openState)
|
| | | {
|
| | | case -1:
|
| | | seconds = openSeconds;
|
| | | return FlashRushToBuySate.InAdvance;
|
| | | case 0:
|
| | | return FlashRushToBuySate.Begining;
|
| | | }
|
| | |
|
| | | switch(endState)
|
| | | {
|
| | | case -1:
|
| | | return FlashRushToBuySate.Begining;
|
| | | case 0:
|
| | | return FlashRushToBuySate.Begining;
|
| | | case 1:
|
| | | return FlashRushToBuySate.End;
|
| | | default:
|
| | | return FlashRushToBuySate.NoOpen;
|
| | | }
|
| | | }
|
| | |
|
| | | public bool CheckIsPush(out OperationFlashRushToBuy.FlashSaleShop saleShop)
|
| | | {
|
| | | int seconds = 0;
|
| | | OperationTime operationTime;
|
| | | saleShop = null;
|
| | | var buyState = GetActivityState(out seconds,out operationTime,out saleShop);
|
| | | switch (buyState)
|
| | | {
|
| | | case FlashRushToBuySate.NoOpen:
|
| | | break;
|
| | | case FlashRushToBuySate.InAdvance:
|
| | | if(saleShop != null && seconds <= 180)
|
| | | {
|
| | | for(int i = 0; i < saleShop.items.Length; i++)
|
| | | {
|
| | | if(saleShop.items[i].isAppointment == 1)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | break;
|
| | | case FlashRushToBuySate.Begining:
|
| | | return true;
|
| | | case FlashRushToBuySate.End:
|
| | | break;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | private void OperationEndEvent(Operation type, int state)
|
| | | {
|
| | | if (type == Operation.FlashRushToBuy && state == 0)
|
| | | {
|
| | | UpdateRedpoint();
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate(4);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OperationAdvanceEvent(Operation type)
|
| | | {
|
| | | if (type == Operation.FlashRushToBuy)
|
| | | {
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate(4);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OperationStartEvent(Operation type, int state)
|
| | | {
|
| | | if (type == Operation.FlashRushToBuy && state == 0)
|
| | | {
|
| | | UpdateRedpoint();
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate(4);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnDayEvent()
|
| | | {
|
| | | UpdateRedpoint();
|
| | | }
|
| | |
|
| | | public void SetDayRemind()
|
| | | {
|
| | | if (flashSaleRedpoint.state == RedPointState.Simple)
|
| | | {
|
| | | DayRemind.Instance.SetDayRemind(DayRemind.FLASHSALE_REDPOINT, true);
|
| | | UpdateRedpoint();
|
| | | }
|
| | | }
|
| | |
|
| | | public void SendBuyFlashSale(OperationFlashSale.FlashSaleGift gift)
|
| | | {
|
| | | OperationBase operationBase;
|
| | | if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashSale, out operationBase))
|
| | | {
|
| | | OperationFlashSale operation = operationBase as OperationFlashSale;
|
| | | if (operation.InAdvanceTime(TimeUtility.ServerNow))
|
| | | {
|
| | | var seconds = operation.GetSecondsBeforeStart(TimeUtility.ServerNow);
|
| | | SysNotifyMgr.Instance.ShowTip("FlashSaleAdvanceLimit", TimeUtility.SecondsToHMS(seconds));
|
| | | return;
|
| | | }
|
| | | if (!operation.InTime(TimeUtility.ServerNow))
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("ActiveOutTime");
|
| | | return;
|
| | | }
|
| | | if (!gift.Equals(default(OperationFlashSale.FlashSaleGift)))
|
| | | {
|
| | | var buyInfo = storeModel.GetBuyShopLimit((uint)gift.id);
|
| | | var buyCount = 0;
|
| | | if (buyInfo != null)
|
| | | {
|
| | | buyCount = buyInfo.BuyCnt;
|
| | | }
|
| | | if (buyCount >= gift.limitNum)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (UIHelper.GetMoneyCnt(gift.moneyType) < (ulong)gift.moneyNumber)
|
| | | {
|
| | | switch (gift.moneyType)
|
| | | {
|
| | | case 1:
|
| | | if (VersionConfig.Get().isBanShu)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("GoldErr");
|
| | | return;
|
| | | }
|
| | | WindowCenter.Instance.Open<RechargeTipWin>();
|
| | | break;
|
| | | default:
|
| | | SysNotifyMgr.Instance.ShowTip("LackMoney", gift.moneyType);
|
| | | break;
|
| | | }
|
| | | return;
|
| | | }
|
| | | if (gift.moneyType == 1)
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
|
| | | Language.Get("OSTimeLimitGiftConfirm", gift.moneyNumber), (bool isOk) =>
|
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | C0803_tagCBuyItemList pak = new C0803_tagCBuyItemList();
|
| | | pak.NPCID = 0;
|
| | | pak.BuyItemIndex = (ushort)gift.id;
|
| | | pak.BuyCount = 1;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | C0803_tagCBuyItemList pak = new C0803_tagCBuyItemList();
|
| | | pak.NPCID = 0;
|
| | | pak.BuyItemIndex = (ushort)gift.id;
|
| | | pak.BuyCount = 1;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("ActiveOutTime");
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public bool HasNotBuyGift()
|
| | | {
|
| | | OperationBase operationBase;
|
| | | OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashSale, out operationBase);
|
| | | if (operationBase != null && operationBase.InTime(TimeUtility.ServerNow))
|
| | | {
|
| | | OperationFlashSale operation = operationBase as OperationFlashSale;
|
| | | OperationFlashSale.FlashSale flashShop;
|
| | | if (operation.TryGetFlashSale(TimeUtility.ServerNow, out flashShop))
|
| | | {
|
| | | for (int i = 0; i < flashShop.gifts.Length; i++)
|
| | | {
|
| | | var gift = flashShop.gifts[i];
|
| | | var buyInfo = storeModel.GetBuyShopLimit((uint)gift.id);
|
| | | if (buyInfo == null || buyInfo.BuyCnt < gift.limitNum)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public Redpoint flashSaleRedpoint = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, 20904);
|
| | |
|
| | | public event Action<int> onStateUpate;
|
| | |
|
| | | private void UpdateRedpoint()
|
| | | {
|
| | | flashSaleRedpoint.state = RedPointState.None;
|
| | | if (IsOpen && HasNotBuyGift() && !DayRemind.Instance.GetDayRemind(DayRemind.FLASHSALE_REDPOINT))
|
| | | {
|
| | | flashSaleRedpoint.state = RedPointState.Simple;
|
| | | }
|
| | | }
|
| | |
|
| | | public enum FlashRushToBuySate
|
| | | {
|
| | | NoOpen, //活动未开启
|
| | | InAdvance,//提前
|
| | | Begining, //活动中
|
| | | End, //结束
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1155d8a33808d2640ab01bedff0bb06b |
| | | timeCreated: 1539086199 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class FlashRushToBuyNotify : OpenServerActivityNotifyBase
|
| | | {
|
| | | public FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
| | | public const string iconKey = "TB_BGL_2";
|
| | | private void OnEnable()
|
| | | {
|
| | | Display();
|
| | | }
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | |
| | | }
|
| | |
|
| | | protected override void Display()
|
| | | {
|
| | | base.Display();
|
| | | titleText.text = "限时抢购";
|
| | | activityIcon.SetSprite(iconKey);
|
| | | }
|
| | |
|
| | | protected override void ClickGotoBtn()
|
| | | {
|
| | | base.ClickGotoBtn();
|
| | | this.gameObject.SetActive(false);
|
| | | WindowCenter.Instance.Open<FlashRushToBuyWin>();
|
| | | }
|
| | | protected override void ClickCloseBtn()
|
| | | {
|
| | | base.ClickCloseBtn();
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f1b3cf08873bf564ea2ec5d7d71afd41 |
| | | timeCreated: 1539423553 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class FlashRushToBuyWin : Window
|
| | | {
|
| | | [SerializeField] ScrollerController saleItemCtrl;
|
| | | [SerializeField] ScrollerController saleTimeCtrl;
|
| | | [SerializeField] Text opreationTimeText;
|
| | | [SerializeField] Image moneyIcon;
|
| | | [SerializeField] Text moneyNumText;
|
| | |
|
| | | StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
|
| | | FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
| | | OperationFlashRushToBuy operation = null;
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | rushToBuyModel.SetDefaultSelectSaleTime();
|
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
|
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent += OperationTimeUpdateEvent;
|
| | | rushToBuyModel.UpdateSelectSaleTimeEvent += UpdateSelectSaleTime;
|
| | | SetDisplayModel();
|
| | | Display();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | rushToBuyModel.SetDayRemind();
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | rushToBuyModel.UpdateSelectSaleTimeEvent -= UpdateSelectSaleTime;
|
| | | OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
|
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent -= OperationTimeUpdateEvent;
|
| | | rushToBuyModel.ResetFlashShop();
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | }
|
| | | #endregion
|
| | |
|
| | | private void SetDisplayModel()
|
| | | {
|
| | | operation = null;
|
| | | OperationBase operationBase;
|
| | | if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashRushToBuy, out operationBase))
|
| | | {
|
| | | operation = operationBase as OperationFlashRushToBuy; |
| | | }
|
| | | }
|
| | |
|
| | | private void Display()
|
| | | {
|
| | | if (rushToBuyModel.presentFlashShop == null|| operation == null) return;
|
| | |
|
| | | opreationTimeText.text = StringUtility.Contact(Language.Get("ExpActivity_Text1"), operation.ToDisplayTime());
|
| | | if (rushToBuyModel.presentFlashShop.items.Length > 0)
|
| | | {
|
| | | var moneyType = rushToBuyModel.presentFlashShop.items[0].moneyType;
|
| | | moneyIcon.SetIconWithMoneyType(moneyType);
|
| | | moneyNumText.text = UIHelper.GetMoneyCnt(moneyType).ToString();
|
| | | }
|
| | | CreateOperationTimes();
|
| | | CreateSaleItem();
|
| | | }
|
| | |
|
| | |
|
| | | private void UpdateSelectSaleTime()
|
| | | {
|
| | | CreateSaleItem();
|
| | | saleTimeCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | | private void CreateOperationTimes()
|
| | | {
|
| | | if (operation == null) return;
|
| | |
|
| | | saleTimeCtrl.Refresh();
|
| | | for (int i = 0; i < operation.flashShops.Count; i++)
|
| | | {
|
| | | saleTimeCtrl.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | | saleTimeCtrl.Restart();
|
| | | }
|
| | |
|
| | | public void CreateSaleItem()
|
| | | {
|
| | | saleItemCtrl.Refresh();
|
| | | var flashItems = rushToBuyModel.presentFlashShop.items;
|
| | | for (int i = 0; i < flashItems.Length; i++)
|
| | | {
|
| | | saleItemCtrl.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | | saleItemCtrl.Restart();
|
| | | }
|
| | |
|
| | | private void OperationTimeUpdateEvent(Operation type)
|
| | | {
|
| | | if (type == Operation.FlashRushToBuy)
|
| | | {
|
| | | Display();
|
| | | }
|
| | | }
|
| | | |
| | | private void OperationStartEvent(Operation type, int state)
|
| | | {
|
| | | if (type == Operation.FlashRushToBuy && state == 0)
|
| | | {
|
| | | Display();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e1ea7b55e1cc21b42906a2e6984b29cd |
| | | timeCreated: 1539069491 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | using EnhancedUI.EnhancedScroller;
|
| | | using TableConfig;
|
| | | using System;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class FlashSaleItemCell : ScrollerUI
|
| | | {
|
| | | [SerializeField] CommonItemBaisc itemBaisc;
|
| | | [SerializeField] Text originalPrice;
|
| | | [SerializeField] Image originalMoneyIcon;
|
| | | [SerializeField] Text presentPrice;
|
| | | [SerializeField] Image presentMoneyIcon;
|
| | | [SerializeField] Image stateImg;
|
| | | [SerializeField] Button flashSaleBtn;
|
| | | [SerializeField] Text btnStateText;
|
| | | [SerializeField] Text fullServerRemainNum;
|
| | |
|
| | | public const int RefreshFullServerBuyType = 8;
|
| | |
|
| | | FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
| | | StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
|
| | | HeavenBattleModel battleModel { get { return ModelCenter.Instance.GetModel<HeavenBattleModel>(); } }
|
| | | ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
| | |
|
| | | OperationFlashRushToBuy.FlashSaleItem saleItem;
|
| | |
|
| | | private void OnEnable()
|
| | | {
|
| | | battleModel.RefreshGameRecInfoAct += UpdateFullServerBuy;
|
| | | storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent;
|
| | | rushToBuyModel.UpdateAllAppointmentEvent += UpdateAllAppointmentInfo;
|
| | | rushToBuyModel.UpdateAppointmentEvent += UpdateAppointmentInfo;
|
| | | }
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | storeModel.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent;
|
| | | battleModel.RefreshGameRecInfoAct -= UpdateFullServerBuy;
|
| | | rushToBuyModel.UpdateAllAppointmentEvent -= UpdateAllAppointmentInfo;
|
| | | rushToBuyModel.UpdateAppointmentEvent -= UpdateAppointmentInfo;
|
| | | }
|
| | |
|
| | | public override void Refresh(CellView cell)
|
| | | {
|
| | | if (rushToBuyModel.presentFlashShop == null) return;
|
| | |
|
| | | saleItem = rushToBuyModel.presentFlashShop.items[cell.index];
|
| | | ItemCellModel cellModel = new ItemCellModel(saleItem.itemId,true,(ulong)saleItem.itemCount,saleItem.isBind);
|
| | | itemBaisc.Init(cellModel);
|
| | | itemBaisc.cellBtn.RemoveAllListeners();
|
| | | itemBaisc.cellBtn.AddListener(()=>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(saleItem.itemId,true, (ulong)saleItem.itemCount, -1,saleItem.isBind);
|
| | | tipsModel.SetItemTipsModel(attrData);
|
| | | });
|
| | | originalMoneyIcon.SetIconWithMoneyType(saleItem.moneyType);
|
| | | presentMoneyIcon.SetIconWithMoneyType(saleItem.moneyType);
|
| | | originalPrice.text = saleItem.moneyOriginal.ToString();
|
| | | presentPrice.text = saleItem.moneyNumber.ToString();
|
| | | UpdateSaleItem();
|
| | | UpdateSaleItemSellState();
|
| | | }
|
| | |
|
| | | private void RefreshBuyShopLimitEvent()
|
| | | {
|
| | | UpdateSaleItemSellState();
|
| | | }
|
| | |
|
| | | private void UpdateFullServerBuy(int type)
|
| | | {
|
| | | if (type != RefreshFullServerBuyType) return;
|
| | | UpdateSaleItemSellState();
|
| | | }
|
| | |
|
| | |
|
| | | private void UpdateAllAppointmentInfo()
|
| | | {
|
| | | UpdateSaleItem();
|
| | | }
|
| | |
|
| | | private void UpdateAppointmentInfo(int shopGuid)
|
| | | {
|
| | | if (saleItem == null || shopGuid != saleItem.shopGuid) return;
|
| | | UpdateSaleItem();
|
| | | }
|
| | |
|
| | | private void UpdateSaleItem()
|
| | | {
|
| | | if (rushToBuyModel.presentFlashShop == null) return;
|
| | |
|
| | | StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(saleItem.shopId);
|
| | | flashSaleBtn.RemoveAllListeners();
|
| | | var operation = rushToBuyModel.GetOperationFlashRushToBuy();
|
| | | int seconds = 0;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,rushToBuyModel.presentFlashShop.dayIndex,
|
| | | rushToBuyModel.presentFlashShop.timeIndex,out seconds);
|
| | |
|
| | | switch(buyState)
|
| | | {
|
| | | case -1:
|
| | | if(saleItem.isAppointment == 0)
|
| | | {
|
| | | btnStateText.text = "预约";
|
| | | flashSaleBtn.AddListener(() => { rushToBuyModel.SendFlashSaleAppointment(saleItem.shopGuid, 1); });
|
| | | }
|
| | | else
|
| | | {
|
| | | btnStateText.text = "取消预约";
|
| | | flashSaleBtn.AddListener(() => { rushToBuyModel.SendFlashSaleAppointment(saleItem.shopGuid, 0); });
|
| | | }
|
| | | break;
|
| | | case 0:
|
| | | btnStateText.text = "秒杀";
|
| | | flashSaleBtn.AddListener(() => { storeModel.SendBuyShopItem(storeConfig,saleItem.itemCount); });
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateSaleItemSellState()
|
| | | {
|
| | | int fullSeverRemain = 0;
|
| | | int sellState = GetSellSate(out fullSeverRemain);
|
| | | fullServerRemainNum.text = fullSeverRemain.ToString();
|
| | | switch (sellState)
|
| | | {
|
| | | case 0:
|
| | | stateImg.gameObject.SetActive(false);
|
| | | flashSaleBtn.gameObject.SetActive(true);
|
| | | break;
|
| | | case 1:
|
| | | stateImg.gameObject.SetActive(true);
|
| | | flashSaleBtn.gameObject.SetActive(false);
|
| | | break;
|
| | | case 2:
|
| | | stateImg.gameObject.SetActive(true);
|
| | | flashSaleBtn.gameObject.SetActive(false);
|
| | | break;
|
| | | }
|
| | |
|
| | | }
|
| | | /// <summary>
|
| | | /// 0 秒杀 1 已买到 2 已抢光
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private int GetSellSate(out int fullRemainNum)
|
| | | {
|
| | | var buyInfo = storeModel.GetBuyShopLimit((uint)saleItem.shopId);
|
| | | var buyCount = 0;
|
| | | var fullServerInfo = rushToBuyModel.GetFullServerInfo();
|
| | | fullRemainNum = 0;
|
| | | if (fullServerInfo != null && fullServerInfo.Value1 == saleItem.shopId)
|
| | | {
|
| | | fullRemainNum = saleItem.fullServerLimitNum - fullServerInfo.Value2;
|
| | | }
|
| | | else
|
| | | {
|
| | | fullRemainNum = saleItem.fullServerLimitNum;
|
| | | }
|
| | | if (buyInfo != null)
|
| | | {
|
| | | buyCount = buyInfo.BuyCnt;
|
| | | }
|
| | | if(buyCount >= saleItem.limitNum)
|
| | | {
|
| | | return 1;
|
| | | }
|
| | |
|
| | | if (fullRemainNum <= 0)
|
| | | {
|
| | | return 2;
|
| | | }
|
| | |
|
| | | return 0;
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0159981474f2dbb4599489e57560e8e6 |
| | | timeCreated: 1539070008 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | using EnhancedUI.EnhancedScroller;
|
| | | using System;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class FlashSaleTimeCell : ScrollerUI
|
| | | {
|
| | | [SerializeField] Text remainText;
|
| | | [SerializeField] Button saleTimeBtn;
|
| | | [SerializeField] GameObject unSelectImg;
|
| | | [SerializeField] GameObject selectImg;
|
| | |
|
| | | FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
| | | OperationFlashRushToBuy operation;
|
| | | int dayIndex = -1;
|
| | | int timeIndex = -1;
|
| | | private void Awake()
|
| | | {
|
| | | saleTimeBtn.AddListener(() =>
|
| | | {
|
| | | rushToBuyModel.UpdateSelectFlashSaleTime(dayIndex, timeIndex);
|
| | | });
|
| | | }
|
| | | private void OnEnable()
|
| | | {
|
| | | GlobalTimeEvent.Instance.secondEvent += UpdateBuyState;
|
| | | }
|
| | | private void OnDisable()
|
| | | {
|
| | | GlobalTimeEvent.Instance.secondEvent -= UpdateBuyState;
|
| | | }
|
| | | public override void Refresh(CellView cell)
|
| | | {
|
| | | operation = rushToBuyModel.GetOperationFlashRushToBuy();
|
| | | dayIndex = -1;
|
| | | timeIndex = -1;
|
| | | if (operation == null) return;
|
| | |
|
| | | int days = operation.totalDays + 1;
|
| | | dayIndex = cell.index/(operation.flashShops.Count / days);
|
| | | timeIndex = cell.index % (operation.flashShops.Count / days);
|
| | | if(dayIndex == rushToBuyModel.presentFlashShop.dayIndex |
| | | && timeIndex == rushToBuyModel.presentFlashShop.timeIndex)
|
| | | {
|
| | | selectImg.SetActive(true);
|
| | | unSelectImg.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | selectImg.SetActive(false);
|
| | | unSelectImg.SetActive(true);
|
| | | }
|
| | | UpdateBuyState();
|
| | | }
|
| | |
|
| | | public void UpdateBuyState()
|
| | | {
|
| | | if (operation == null || timeIndex == -1) return;
|
| | |
|
| | | int seconds = 0;
|
| | | OperationTime operationTime = operation.times[timeIndex];
|
| | | var date = operation.startDate;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, dayIndex, timeIndex, out seconds);
|
| | | switch (buyState)
|
| | | {
|
| | | case -1:
|
| | | this.gameObject.SetActive(true);
|
| | | string timeStr = operation.ToDisplayBuyTime(date.month, dayIndex + date.day, operationTime.startHour, operationTime.startMinute);
|
| | | remainText.text = StringUtility.Contact(timeStr, "开抢");
|
| | | break;
|
| | | case 0:
|
| | | this.gameObject.SetActive(true);
|
| | | remainText.text = StringUtility.Contact("秒杀进行中", TimeUtility.SecondsToHMS(seconds));
|
| | | break;
|
| | | case 1:
|
| | | if(selectImg.activeInHierarchy)
|
| | | {
|
| | | rushToBuyModel.SetDefaultSelectSaleTime();
|
| | | }
|
| | | this.gameObject.SetActive(false);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 45a3148a13dcdbb40b43bf5b9667ca8e |
| | | timeCreated: 1539070917 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class OpenServerActivityNotifyBase : MonoBehaviour
|
| | | {
|
| | | [SerializeField] protected Text titleText;
|
| | | [SerializeField] protected Image activityIcon;
|
| | | [SerializeField] protected Button gotoBtn;
|
| | | [SerializeField] protected Button closeBtn;
|
| | |
|
| | | private void Awake()
|
| | | {
|
| | | gotoBtn.AddListener(ClickGotoBtn);
|
| | | closeBtn.AddListener(ClickCloseBtn);
|
| | | }
|
| | |
|
| | | protected virtual void Display()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | protected virtual void ClickGotoBtn()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | protected virtual void ClickCloseBtn()
|
| | | {
|
| | | this.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 22be8e7eacfacb343b53b11b5d22aa29 |
| | | timeCreated: 1539422752 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using System.Text;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class OpenServerActivityNotifyModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk
|
| | | {
|
| | | |
| | | public override void Init()
|
| | | {
|
| | | |
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | FlashRushToBuyActivityClose();
|
| | | GlobalTimeEvent.Instance.minuteEvent -= UpdateMinute;
|
| | | OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
|
| | | OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
|
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent -= OperationTimeEvent;
|
| | | OperationTimeHepler.Instance.operationServerCloseEvent -= OperationServerCloseEvent;
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
|
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
|
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent += OperationTimeEvent;
|
| | | OperationTimeHepler.Instance.operationServerCloseEvent += OperationServerCloseEvent;
|
| | | GlobalTimeEvent.Instance.minuteEvent += UpdateMinute;
|
| | | SetFlashRushToBuyNotify();
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | |
| | | }
|
| | |
|
| | | private void UpdateMinute()
|
| | | {
|
| | | SetFlashRushToBuyNotify();
|
| | | }
|
| | |
|
| | | private void OperationTimeEvent(Operation type)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case Operation.MultipleExp:
|
| | | break;
|
| | | case Operation.ConsumeRebate:
|
| | | break;
|
| | | case Operation.FlashSale:
|
| | | break;
|
| | | case Operation.BossReborn:
|
| | | break;
|
| | | case Operation.GiftPackage:
|
| | | break;
|
| | | case Operation.FairyCeremony:
|
| | | break;
|
| | | case Operation.MultipRealmPoint:
|
| | | break;
|
| | | case Operation.FlashRushToBuy:
|
| | | SetFlashRushToBuyNotify();
|
| | | break;
|
| | | case Operation.max:
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void OperationStartEvent(Operation type, int state)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case Operation.MultipleExp:
|
| | | break;
|
| | | case Operation.ConsumeRebate:
|
| | | break;
|
| | | case Operation.FlashSale:
|
| | | break;
|
| | | case Operation.BossReborn:
|
| | | break;
|
| | | case Operation.GiftPackage:
|
| | | break;
|
| | | case Operation.FairyCeremony:
|
| | | break;
|
| | | case Operation.MultipRealmPoint:
|
| | | break;
|
| | | case Operation.FlashRushToBuy:
|
| | | SetFlashRushToBuyNotify();
|
| | | break;
|
| | | case Operation.max:
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | private void OperationServerCloseEvent(Operation type)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case Operation.MultipleExp:
|
| | | break;
|
| | | case Operation.ConsumeRebate:
|
| | | break;
|
| | | case Operation.FlashSale:
|
| | | break;
|
| | | case Operation.BossReborn:
|
| | | break;
|
| | | case Operation.GiftPackage:
|
| | | break;
|
| | | case Operation.FairyCeremony:
|
| | | break;
|
| | | case Operation.MultipRealmPoint:
|
| | | break;
|
| | | case Operation.FlashRushToBuy:
|
| | | FlashRushToBuyActivityClose();
|
| | | break;
|
| | | case Operation.max:
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void OperationEndEvent(Operation type, int state)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case Operation.MultipleExp:
|
| | | break;
|
| | | case Operation.ConsumeRebate:
|
| | | break;
|
| | | case Operation.FlashSale:
|
| | | break;
|
| | | case Operation.BossReborn:
|
| | | break;
|
| | | case Operation.GiftPackage:
|
| | | break;
|
| | | case Operation.FairyCeremony:
|
| | | break;
|
| | | case Operation.MultipRealmPoint:
|
| | | break;
|
| | | case Operation.FlashRushToBuy:
|
| | | FlashRushToBuyActivityClose();
|
| | | break;
|
| | | case Operation.max:
|
| | | break;
|
| | | }
|
| | | }
|
| | | #region 限时抢购
|
| | | public event Action UpdateFlashRushToBuyEvent;
|
| | | FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
| | | public List<OperationFlashRushToBuy.FlashSaleShop> flashSaleShops = new List<OperationFlashRushToBuy.FlashSaleShop>();
|
| | | public void SetFlashRushToBuyNotify()
|
| | | {
|
| | | OperationFlashRushToBuy.FlashSaleShop saleShop = null;
|
| | | bool isPush = rushToBuyModel.CheckIsPush(out saleShop);
|
| | | if(isPush && !flashSaleShops.Contains(saleShop))
|
| | | {
|
| | | flashSaleShops.Add(saleShop);
|
| | | if(UpdateFlashRushToBuyEvent != null)
|
| | | {
|
| | | UpdateFlashRushToBuyEvent();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void FlashRushToBuyActivityClose()
|
| | | {
|
| | | flashSaleShops.Clear();
|
| | | if (UpdateFlashRushToBuyEvent != null)
|
| | | {
|
| | | UpdateFlashRushToBuyEvent();
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2a78df4065d071145b2e5877404cd6fd |
| | | timeCreated: 1539572551 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class OpenServerActivityNotifyWin : Window
|
| | | {
|
| | | [SerializeField] FlashRushToBuyNotify flashRushToBuyNotify;
|
| | | OpenServerActivityNotifyModel activityNotifyModel { get { return ModelCenter.Instance.GetModel<OpenServerActivityNotifyModel>(); } }
|
| | | protected override void BindController()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | |
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | { |
| | | activityNotifyModel.UpdateFlashRushToBuyEvent += CheckFlashRushToBuy;
|
| | | CheckFlashRushToBuy();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | |
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | activityNotifyModel.UpdateFlashRushToBuyEvent -= CheckFlashRushToBuy;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | private void CheckFlashRushToBuy()
|
| | | {
|
| | | if(activityNotifyModel.flashSaleShops.Count > 0)
|
| | | {
|
| | | flashRushToBuyNotify.gameObject.SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | flashRushToBuyNotify.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: aa084ec4d5a2ea446b5ec00c0e1cc687 |
| | | timeCreated: 1539422752 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class OperationFlashRushToBuy : OperationBase
|
| | | {
|
| | | public List<FlashSaleShop> flashShops = new List<FlashSaleShop>();
|
| | |
|
| | | public bool TryGetFlashShop(int dayIndex,int timeIndex ,out FlashSaleShop flashSaleShop)
|
| | | {
|
| | | flashSaleShop = null;
|
| | | for (int i = 0; i < flashShops.Count; i++)
|
| | | {
|
| | | var shop = flashShops[i];
|
| | | if (shop.dayIndex == dayIndex
|
| | | && shop.timeIndex == timeIndex)
|
| | | {
|
| | | flashSaleShop = shop;
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool TryGetFlashItem(int shopGuid,out FlashSaleShop flashSaleShop, out FlashSaleItem saleItem)
|
| | | {
|
| | | saleItem = null;
|
| | | flashSaleShop = null;
|
| | | for (int i = 0; i < flashShops.Count; i++)
|
| | | {
|
| | | var saleItems = flashShops[i].items;
|
| | | for (int j = 0; j < saleItems.Length; j++)
|
| | | {
|
| | | if (saleItems[j].shopGuid == shopGuid)
|
| | | {
|
| | | flashSaleShop = flashShops[i];
|
| | | saleItem = saleItems[j];
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | return false;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | ///-1 未开始 0 开始 1结束
|
| | | /// </summary>
|
| | | /// <param name="time"></param>
|
| | | /// <param name="dayIndex"></param>
|
| | | /// <param name="timeIndex"></param>
|
| | | /// <returns></returns>
|
| | | public int GetBuyTimeState(DateTime time,int dayIndex,int timeIndex,out int seconds)
|
| | | {
|
| | | seconds = 0;
|
| | | int day = startDate.day + dayIndex;
|
| | | OperationTime operationTime = times[timeIndex];
|
| | | var startTime = new DateTime(startDate.year, startDate.month,day, operationTime.startHour, operationTime.startMinute,0);
|
| | | var endTime = new DateTime(startDate.year, startDate.month,day, operationTime.endHour, operationTime.endHour, 0);
|
| | | int advanceSec = Mathf.CeilToInt((float)(startTime - time).TotalSeconds);
|
| | | int endSec = Mathf.CeilToInt((float)(endTime - time).TotalSeconds);
|
| | | if (advanceSec > 0)
|
| | | {
|
| | | seconds = advanceSec;
|
| | | return -1;
|
| | | }
|
| | | else if(endSec <= 0)
|
| | | {
|
| | | return 1;
|
| | | }
|
| | | else
|
| | | {
|
| | | seconds = endSec;
|
| | | return 0;
|
| | | }
|
| | | }
|
| | |
|
| | | public string ToDisplayBuyTime(int month,int day,int startHour,int startMinute)
|
| | | {
|
| | | return StringUtility.Contact(month, Language.Get("Month"), day, Language.Get("Day"), startHour.ToString("D2"), ":", startMinute.ToString("D2"));
|
| | | }
|
| | |
|
| | | public string ToDisplayBuyTime(int startHour, int startMinute)
|
| | | {
|
| | | return StringUtility.Contact(startHour.ToString("D2"), ":", startMinute.ToString("D2"));
|
| | | }
|
| | |
|
| | | public override bool SatisfyOpenCondition()
|
| | | {
|
| | | if(PlayerDatas.Instance.baseData.LV >= limitLv && InDay(TimeUtility.ServerNow))
|
| | | {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public override void Reset()
|
| | | {
|
| | | base.Reset();
|
| | | flashShops.Clear();
|
| | | }
|
| | |
|
| | | public override string ToDisplayTime()
|
| | | {
|
| | | var textBuilder = OperationTimeHepler.textBuilder;
|
| | | textBuilder.Length = 0;
|
| | | textBuilder.Append(startDate.ToDisplay());
|
| | | if (startDate != endDate)
|
| | | {
|
| | | textBuilder.Append("—");
|
| | | textBuilder.Append(endDate.ToDisplay());
|
| | | }
|
| | | return textBuilder.ToString();
|
| | | }
|
| | |
|
| | | public void ParsePackage(HAA17_tagMCFlashSaleInfo package)
|
| | | {
|
| | | for (int i = 0; i < package.ShopCount; i++)
|
| | | {
|
| | | var gift = new FlashSaleShop();
|
| | | var shop = package.ShopInfo[i];
|
| | | gift.dayIndex = shop.DayIndex;
|
| | | gift.timeIndex = shop.TimeIndex;
|
| | | gift.items = new FlashSaleItem[shop.GiftbagCount];
|
| | | for (int k = 0; k < shop.GiftbagCount; k++)
|
| | | {
|
| | | var item = new FlashSaleItem();
|
| | | var saleItem = shop.GiftbagInfo[k];
|
| | | item.shopId = (int)saleItem.GiftID;
|
| | | item.shopGuid = shop.DayIndex*1000 + shop.TimeIndex*100 + k;
|
| | | item.limitNum = saleItem.BuyCountLimit;
|
| | | item.fullServerLimitNum = saleItem.ServerBuyCountLimit;
|
| | | item.moneyType = saleItem.MoneyType;
|
| | | item.moneyNumber = (int)saleItem.MoneyNumber;
|
| | | item.moneyOriginal = (int)saleItem.MoneyOriginal;
|
| | | item.itemId = (int)saleItem.ItemID;
|
| | | item.itemCount = saleItem.ItemCount;
|
| | | item.isBind = saleItem.IsBind;
|
| | | item.isAppointment = 0;
|
| | | gift.items[k] = item;
|
| | | }
|
| | | flashShops.Add(gift);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | public class FlashSaleShop
|
| | | {
|
| | | public int dayIndex; // 活动第几天
|
| | | public int timeIndex;//第几个时间段
|
| | | public FlashSaleItem[] items;
|
| | | }
|
| | |
|
| | | public class FlashSaleItem
|
| | | {
|
| | | public int shopId;
|
| | | public int shopGuid;
|
| | | public int limitNum;//个人限购数量
|
| | | public int fullServerLimitNum; //个人限购数量
|
| | | public int moneyType;
|
| | | public int moneyNumber;
|
| | | public int moneyOriginal;
|
| | | public int itemId;
|
| | | public int itemCount;
|
| | | public int isBind;
|
| | | public int isAppointment; //是否预约
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6b7d522af470b8a42b9127be5090cb6f |
| | | timeCreated: 1539088859 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | {
|
| | | public const int WholePeopleRankStart = 2091000; //全民冲榜开始
|
| | | public const int WholePeopleRankEnd = 20910000; //全民冲榜截止
|
| | |
|
| | | public const int FlashRushToBuy = 209014; //限时抢购
|
| | | ImpactRankModel impactRank { get { return ModelCenter.Instance.GetModel<ImpactRankModel>(); } }
|
| | | FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
| | |
|
| | | private List<int> rankTypelist = new List<int>();
|
| | |
|
| | | public override void Init()
|
| | |
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | |
|
| | | rushToBuyModel.UpdateAllAppointmentEvent -= UpdateAllAppointment;
|
| | | rushToBuyModel.UpdateAppointmentEvent -= UpdateAppointment;
|
| | | GlobalTimeEvent.Instance.minuteEvent -= RefreshMinuteTime;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange -= RefreshOpenServerState;
|
| | | }
|
| | |
|
| | | public void OnAfterPlayerDataInitialize()
|
| | |
| | | {
|
| | | SetRankStartPushInfo();
|
| | | SetRankEndPushInfo();
|
| | | GlobalTimeEvent.Instance.minuteEvent -= RefreshMinuteTime;
|
| | | SetFlashRushToBuyAppointmentInfo();
|
| | | GlobalTimeEvent.Instance.minuteEvent += RefreshMinuteTime;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange -= RefreshOpenServerState;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange += RefreshOpenServerState;
|
| | | rushToBuyModel.UpdateAllAppointmentEvent += UpdateAllAppointment;
|
| | | rushToBuyModel.UpdateAppointmentEvent += UpdateAppointment;
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | |
| | | {
|
| | | RemovePushByTime(PushInfoType.RankStart,11);
|
| | | RemovePushByTime(PushInfoType.RankEnd,23);
|
| | | RemoveFlashRushToBuyAppointmentByTime();
|
| | | }
|
| | |
|
| | | private void RefreshOpenServerState()
|
| | |
| | | SetRankEndPushInfo();
|
| | | RemovePushByActiveClose(PushInfoType.RankStart);
|
| | | RemovePushByActiveClose(PushInfoType.RankEnd);
|
| | | SetFlashRushToBuyAppointmentInfo();
|
| | | }
|
| | |
|
| | | #region 开服活动冲榜推送
|
| | | private void SetRankStartPushInfo()
|
| | | {
|
| | | for(int i = 0; i <rankTypelist.Count; i++)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void RemovePushByTime(PushInfoType type,int time)
|
| | | private void RemovePushByTime(PushInfoType type, int time)
|
| | | {
|
| | | int remainHour = time - TimeUtility.ServerNow.Hour;
|
| | | int remainMinute = 0 - TimeUtility.ServerNow.Minute;
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 限时抢购推送
|
| | | private void UpdateAllAppointment()
|
| | | {
|
| | | SetFlashRushToBuyAppointmentInfo();
|
| | | }
|
| | |
|
| | | private void UpdateAppointment(int shopGuid)
|
| | | {
|
| | | if (!rushToBuyModel.IsOpen) return;
|
| | |
|
| | | var operation = rushToBuyModel.GetOperationFlashRushToBuy();
|
| | | int pushId = FlashRushToBuy * 10 + shopGuid;
|
| | | OperationFlashRushToBuy.FlashSaleItem saleItem;
|
| | | OperationFlashRushToBuy.FlashSaleShop saleShop;
|
| | | bool isSaleItem = operation.TryGetFlashItem(shopGuid,out saleShop,out saleItem);
|
| | | if(isSaleItem)
|
| | | {
|
| | | if(saleItem.isAppointment != 1)
|
| | | {
|
| | | RemovePushInfo(pushId);
|
| | | }
|
| | | else
|
| | | {
|
| | | int seconds = 0;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, saleShop.dayIndex, saleShop.timeIndex, out seconds);
|
| | | if(seconds > 800)
|
| | | {
|
| | | int remainSecond = seconds - 600;
|
| | | SendPushInfo(GetPushJsonData(pushId, remainSecond, "限时抢购", "亲爱的道友,您预约的限时抢购商品即将开抢,请尽快进入游戏秒杀!"));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void SetFlashRushToBuyAppointmentInfo()
|
| | | {
|
| | | if (!rushToBuyModel.IsOpen) return;
|
| | |
|
| | | var operation = rushToBuyModel.GetOperationFlashRushToBuy();
|
| | | for(int i = 0; i < operation.flashShops.Count; i++)
|
| | | {
|
| | | var flashShop = operation.flashShops[i];
|
| | | int seconds = 0;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, flashShop.dayIndex,flashShop.timeIndex,out seconds);
|
| | | var saleItems = operation.flashShops[i].items;
|
| | | for (int j = 0; j < saleItems.Length; j++)
|
| | | {
|
| | | int pushId = FlashRushToBuy * 10 + saleItems[j].shopGuid;
|
| | | if (buyState == -1 && seconds > 800 && saleItems[j].isAppointment == 1)
|
| | | {
|
| | | int remainSecond = seconds - 600;
|
| | | SendPushInfo(GetPushJsonData(pushId, remainSecond, "限时抢购", "亲爱的道友,您预约的限时抢购商品即将开抢,请尽快进入游戏秒杀!"));
|
| | | }
|
| | | else
|
| | | {
|
| | | RemovePushInfo(pushId);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void RemoveFlashRushToBuyAppointmentByTime()
|
| | | {
|
| | | if (!rushToBuyModel.IsOpen) return;
|
| | |
|
| | | var operation = rushToBuyModel.GetOperationFlashRushToBuy();
|
| | | for (int i = 0; i < operation.flashShops.Count; i++)
|
| | | {
|
| | | var flashShop = operation.flashShops[i];
|
| | | int seconds = 0;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, flashShop.dayIndex, flashShop.timeIndex, out seconds);
|
| | | var saleItems = operation.flashShops[i].items;
|
| | | for (int j = 0; j < saleItems.Length; j++)
|
| | | {
|
| | | int pushId = FlashRushToBuy * 10 + saleItems[j].shopGuid;
|
| | | if (buyState != -1)
|
| | | {
|
| | | RemovePushInfo(pushId);
|
| | | }
|
| | | else
|
| | | {
|
| | | if(seconds <= 180)
|
| | | {
|
| | | RemovePushInfo(pushId);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | #endregion
|
| | | public void RemovePushInfo(int pushId)
|
| | | {
|
| | | SDKUtility.Instance.GeTui_RemoveLocalMessage(pushId.ToString());
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 限时抢购
|
| | | /// </summary>
|
| | | /// <param name="package"></param>
|
| | | public void UpdateFlashRushToBuy(HAA17_tagMCFlashSaleInfo package)
|
| | | {
|
| | | OperationBase operationBase = null;
|
| | | operationDict.TryGetValue(Operation.FlashRushToBuy, out operationBase);
|
| | | if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
|
| | | {
|
| | | ForceStopOperation(Operation.FlashRushToBuy);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (operationBase == null)
|
| | | {
|
| | | operationBase = new OperationFlashRushToBuy();
|
| | | operationDict.Add(Operation.FlashRushToBuy, operationBase);
|
| | | }
|
| | | OperationFlashRushToBuy operation = operationBase as OperationFlashRushToBuy;
|
| | | operation.Reset();
|
| | | operation.limitLv = package.LimitLV;
|
| | | operation.startDate = ParseOperationDate(package.StartDate);
|
| | | operation.endDate = ParseOperationDate(package.EndtDate);
|
| | | operation.dayReset = package.IsDayReset == 1;
|
| | | operation.inAdvanceMinute = package.AdvanceMinutes;
|
| | | for (int i = 0; i < package.ActivityTimeCount; i++)
|
| | | {
|
| | | operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,
|
| | | package.ActivityTime[i].EndtTime));
|
| | | }
|
| | | operation.ParsePackage(package);
|
| | | if (operationTimeUpdateEvent != null)
|
| | | {
|
| | | operationTimeUpdateEvent(Operation.FlashRushToBuy);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 限时礼包
|
| | | /// </summary>
|
| | | /// <param name="package"></param>
|
| | |
| | | {
|
| | | MultipleExp,
|
| | | ConsumeRebate,
|
| | | FlashSale,
|
| | | FlashSale,//限时特惠
|
| | | BossReborn,
|
| | | GiftPackage,
|
| | | FairyCeremony, //仙界盛典
|
| | | MultipRealmPoint, //N倍修行点
|
| | | FlashRushToBuy, //限时抢购
|
| | | max,
|
| | | }
|
| | | }
|
| | |
| | | RegisterModel<FeatureNoticeModel>();
|
| | | RegisterModel<AwardExchangeModel>();
|
| | | RegisterModel<WheelOfFortuneModel>();
|
| | | RegisterModel<FlashRushToBuyModel>();
|
| | | inited = true;
|
| | | }
|
| | |
|
| | |
| | | public event Action tenMinuteEvent; |
| | | public event Action halfHourEvent; |
| | | public event Action hourEvent;
|
| | | public event Action halfMinuteEvent;
|
| | |
|
| | | int secondBuf = -1;
|
| | | int minuteBuf = -1;
|
| | |
| | | int tenMinuteBuf = -1;
|
| | | int halfHourBuf = -1;
|
| | | int hourBuf = -1;
|
| | | int halfMinuteBuf = -1;
|
| | |
|
| | | public void Begin()
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | var thirtySeconds = second / 30;
|
| | | if (halfMinuteBuf != thirtySeconds)
|
| | | {
|
| | | try
|
| | | {
|
| | | if (halfMinuteEvent != null)
|
| | | {
|
| | | halfMinuteEvent();
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | Debug.LogException(ex);
|
| | | }
|
| | | finally
|
| | | {
|
| | | halfMinuteBuf = thirtySeconds;
|
| | | }
|
| | | }
|
| | |
|
| | | var fiveMinute = minute / 5;
|
| | | if (fiveMinuteBuf != fiveMinute)
|
| | | {
|