| | |
| | | Register(typeof(HA801_tagMCGiveAwardInfo), typeof(DTCA801_tagMCGiveAwardInfo));
|
| | | Register(typeof(HAA88_tagMCActLunhuidianInfo), typeof(DTCAA88_tagMCActLunhuidianInfo));
|
| | | Register(typeof(HAA89_tagMCActLunhuidianPlayerInfo), typeof(DTCAA89_tagMCActLunhuidianPlayerInfo));
|
| | | Register(typeof(HAA87_tagMCActYunshiInfo), typeof(DTCAA87_tagMCActYunshiInfo));
|
| | | }
|
| | |
|
| | |
|
New file |
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: Fish
|
| | | // [ Date ]: 2024年12月20日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | | using System.IO;
|
| | | using System.Threading;
|
| | | using System;
|
| | | using UnityEngine;
|
| | | using LitJson;
|
| | |
|
| | | public partial class TreasureCntAwardConfig
|
| | | {
|
| | |
|
| | | public readonly int ID;
|
| | | public readonly int TreasureType;
|
| | | public readonly int NeedTreasureCnt;
|
| | | public readonly int AwardIndex;
|
| | | public readonly int[][] AwardItemList;
|
| | |
|
| | | public TreasureCntAwardConfig()
|
| | | {
|
| | | }
|
| | |
|
| | | public TreasureCntAwardConfig(string input)
|
| | | {
|
| | | try
|
| | | {
|
| | | var tables = input.Split('\t');
|
| | |
|
| | | int.TryParse(tables[0],out ID); |
| | |
|
| | | int.TryParse(tables[1],out TreasureType); |
| | |
|
| | | int.TryParse(tables[2],out NeedTreasureCnt); |
| | |
|
| | | int.TryParse(tables[3],out AwardIndex); |
| | |
|
| | | AwardItemList = JsonMapper.ToObject<int[][]>(tables[4].Replace("(", "[").Replace(")", "]")); |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | DebugEx.Log(ex);
|
| | | }
|
| | | }
|
| | |
|
| | | static Dictionary<string, TreasureCntAwardConfig> configs = new Dictionary<string, TreasureCntAwardConfig>();
|
| | | public static TreasureCntAwardConfig Get(string id)
|
| | | { |
| | | if (!inited)
|
| | | {
|
| | | Debug.LogError("TreasureCntAwardConfig 还未完成初始化。");
|
| | | return null;
|
| | | }
|
| | | |
| | | if (configs.ContainsKey(id))
|
| | | {
|
| | | return configs[id];
|
| | | }
|
| | |
|
| | | TreasureCntAwardConfig config = null;
|
| | | if (rawDatas.ContainsKey(id))
|
| | | {
|
| | | config = configs[id] = new TreasureCntAwardConfig(rawDatas[id]);
|
| | | rawDatas.Remove(id);
|
| | | }
|
| | |
|
| | | return config;
|
| | | }
|
| | |
|
| | | public static TreasureCntAwardConfig Get(int id)
|
| | | {
|
| | | return Get(id.ToString());
|
| | | }
|
| | |
|
| | | public static List<string> GetKeys()
|
| | | {
|
| | | var keys = new List<string>();
|
| | | keys.AddRange(configs.Keys);
|
| | | keys.AddRange(rawDatas.Keys);
|
| | | return keys;
|
| | | }
|
| | |
|
| | | public static List<TreasureCntAwardConfig> GetValues()
|
| | | {
|
| | | var values = new List<TreasureCntAwardConfig>();
|
| | | values.AddRange(configs.Values);
|
| | |
|
| | | var keys = new List<string>(rawDatas.Keys);
|
| | | for (int i = 0; i < keys.Count; i++)
|
| | | {
|
| | | values.Add(Get(keys[i]));
|
| | | }
|
| | |
|
| | | return values;
|
| | | }
|
| | |
|
| | | public static bool Has(string id)
|
| | | {
|
| | | return configs.ContainsKey(id) || rawDatas.ContainsKey(id);
|
| | | }
|
| | |
|
| | | public static bool Has(int id)
|
| | | {
|
| | | return Has(id.ToString());
|
| | | }
|
| | |
|
| | | public static bool inited { get; private set; }
|
| | | protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>();
|
| | | public static void Init(bool sync=false)
|
| | | {
|
| | | inited = false;
|
| | | var path = string.Empty;
|
| | | if (AssetSource.refdataFromEditor)
|
| | | {
|
| | | path = ResourcesPath.CONFIG_FODLER +"/TreasureCntAward.txt";
|
| | | }
|
| | | else
|
| | | {
|
| | | path = AssetVersionUtility.GetAssetFilePath("config/TreasureCntAward.txt");
|
| | | }
|
| | |
|
| | | configs.Clear();
|
| | | var tempConfig = new TreasureCntAwardConfig();
|
| | | var preParse = tempConfig is IConfigPostProcess;
|
| | |
|
| | | if (sync)
|
| | | {
|
| | | var lines = File.ReadAllLines(path);
|
| | | if (!preParse)
|
| | | {
|
| | | rawDatas = new Dictionary<string, string>(lines.Length - 3);
|
| | | }
|
| | | for (int i = 3; i < lines.Length; i++)
|
| | | {
|
| | | try |
| | | {
|
| | | var line = lines[i];
|
| | | var index = line.IndexOf("\t");
|
| | | if (index == -1)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var id = line.Substring(0, index);
|
| | |
|
| | | if (preParse)
|
| | | {
|
| | | var config = new TreasureCntAwardConfig(line);
|
| | | configs[id] = config;
|
| | | (config as IConfigPostProcess).OnConfigParseCompleted();
|
| | | }
|
| | | else
|
| | | {
|
| | | rawDatas[id] = line;
|
| | | }
|
| | | }
|
| | | catch (System.Exception ex)
|
| | | {
|
| | | Debug.LogError(ex);
|
| | | }
|
| | | }
|
| | | inited = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | ThreadPool.QueueUserWorkItem((object _object) =>
|
| | | {
|
| | | var lines = File.ReadAllLines(path);
|
| | | if (!preParse)
|
| | | {
|
| | | rawDatas = new Dictionary<string, string>(lines.Length - 3);
|
| | | }
|
| | | for (int i = 3; i < lines.Length; i++)
|
| | | {
|
| | | try |
| | | {
|
| | | var line = lines[i];
|
| | | var index = line.IndexOf("\t");
|
| | | if (index == -1)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var id = line.Substring(0, index);
|
| | |
|
| | | if (preParse)
|
| | | {
|
| | | var config = new TreasureCntAwardConfig(line);
|
| | | configs[id] = config;
|
| | | (config as IConfigPostProcess).OnConfigParseCompleted();
|
| | | }
|
| | | else
|
| | | {
|
| | | rawDatas[id] = line;
|
| | | }
|
| | | }
|
| | | catch (System.Exception ex)
|
| | | {
|
| | | Debug.LogError(ex);
|
| | | }
|
| | | }
|
| | |
|
| | | inited = true;
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4bf72edfa9f53fc45afddbfb7f47691d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: Fish
|
| | | // [ Date ]: 2024年7月24日
|
| | | // [ Date ]: 2024年12月24日
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public readonly int OnceLucky;
|
| | | public readonly int FullLucky;
|
| | | public readonly int LuckyGridNum;
|
| | | public readonly string GridNumMaxLimitInfo;
|
| | | public readonly int AwardMoneyType;
|
| | | public readonly int AwardMoneyValue;
|
| | | public readonly string ProbabilityDisplay;
|
| | |
| | |
|
| | | int.TryParse(tables[11],out LuckyGridNum);
|
| | |
|
| | | int.TryParse(tables[12],out AwardMoneyType); |
| | | GridNumMaxLimitInfo = tables[12];
|
| | |
|
| | | int.TryParse(tables[13],out AwardMoneyValue); |
| | | int.TryParse(tables[13],out AwardMoneyType); |
| | |
|
| | | ProbabilityDisplay = tables[14];
|
| | | int.TryParse(tables[14],out AwardMoneyValue); |
| | |
|
| | | ProbabilityDisplay = tables[15];
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
New file |
| | |
| | | using System.Collections.Generic;
|
| | |
|
| | | public partial class TreasureCntAwardConfig : IConfigPostProcess
|
| | | {
|
| | | //<寻宝类型,<奖励记录索引,条目ID>>
|
| | | static Dictionary<int, Dictionary<int, int>> idDict = new Dictionary<int, Dictionary<int, int>>();
|
| | |
|
| | | public void OnConfigParseCompleted()
|
| | | {
|
| | | if (!idDict.ContainsKey(TreasureType))
|
| | | idDict[TreasureType] = new Dictionary<int, int>();
|
| | | idDict[TreasureType][AwardIndex] = ID;
|
| | | }
|
| | |
|
| | | public static Dictionary<int, int> GetAwardIndexDict(int treasureType)
|
| | | {
|
| | | Dictionary<int, int> awardIndexDict;
|
| | | idDict.TryGetValue(treasureType, out awardIndexDict);
|
| | | return awardIndexDict;
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3a08e0b3540f1e24e8cdc1b9ecd9a0c2 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public class DTCAA72_tagMCActTaskPlayerValueInfo : DtcBasic {
|
| | | MissionActModel model { get { return ModelCenter.Instance.GetModel<MissionActModel>(); } }
|
| | | FairyAffinityMissionActModel fairyAffinityMissionActModel { get { return ModelCenter.Instance.GetModel<FairyAffinityMissionActModel>(); } }
|
| | | YunShiMissionActModel yunShiMissionActModel { get { return ModelCenter.Instance.GetModel<YunShiMissionActModel>(); } }
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HAA72_tagMCActTaskPlayerValueInfo vNetData = vNetPack as HAA72_tagMCActTaskPlayerValueInfo;
|
| | | model.UpdateMissionPlayerValueInfo(vNetData);
|
| | | fairyAffinityMissionActModel.UpdateMissionPlayerValueInfo(vNetData);
|
| | | yunShiMissionActModel.UpdateMissionPlayerValueInfo(vNetData);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | MissionActModel model { get { return ModelCenter.Instance.GetModel<MissionActModel>(); } }
|
| | | FairyAffinityMissionActModel fairyAffinityMissionActModel { get { return ModelCenter.Instance.GetModel<FairyAffinityMissionActModel>(); } }
|
| | | YunShiMissionActModel yunShiMissionActModel { get { return ModelCenter.Instance.GetModel<YunShiMissionActModel>(); } }
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HAA73_tagMCActTaskPlayerInfo vNetData = vNetPack as HAA73_tagMCActTaskPlayerInfo;
|
| | | model.UpdateMissionPlayerInfo(vNetData);
|
| | | fairyAffinityMissionActModel.UpdateMissionPlayerInfo(vNetData);
|
| | | yunShiMissionActModel.UpdateMissionPlayerInfo(vNetData);
|
| | | }
|
| | | }
|
| | |
| | | RechargeGiftAct31Model model31 { get { return ModelCenter.Instance.GetModel<RechargeGiftAct31Model>(); } }
|
| | | CustomizedGiftModel customizedGiftModel { get { return ModelCenter.Instance.GetModel<CustomizedGiftModel>(); } }
|
| | | FairyAffinityRechargeGiftActModel fairyAffinityRechargeGiftActModel { get { return ModelCenter.Instance.GetModel<FairyAffinityRechargeGiftActModel>(); } }
|
| | | YunShiRechargeGiftActModel yunShiRechargeGiftActModel { get { return ModelCenter.Instance.GetModel<YunShiRechargeGiftActModel>(); } }
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HAA75_tagMCActBuyCountGiftPlayerInfo vNetData = vNetPack as HAA75_tagMCActBuyCountGiftPlayerInfo;
|
| | |
| | | customizedGiftModel.UpdateBuyCountGiftPlayerInfo(vNetData);
|
| | | model31.UpdateBuyCountGiftPlayerInfo(vNetData);
|
| | | fairyAffinityRechargeGiftActModel.UpdateBuyCountGiftPlayerInfo(vNetData);
|
| | | yunShiRechargeGiftActModel.UpdateBuyCountGiftPlayerInfo(vNetData);
|
| | | }
|
| | | }
|
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using vnxbqy.UI; |
| | | |
| | | // AA 87 运势活动信息 #tagMCActYunshiInfo
|
| | |
|
| | | public class DTCAA87_tagMCActYunshiInfo : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HAA87_tagMCActYunshiInfo vNetData = vNetPack as HAA87_tagMCActYunshiInfo;
|
| | | OperationTimeHepler.Instance.UpdateActYunShiInfo(vNetData);
|
| | | }
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 65014b87550e4e74d9fc0aeefe2e73ea |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // AA 87 运势活动信息 #tagMCActYunshiInfo
|
| | |
|
| | | public class HAA87_tagMCActYunshiInfo : GameNetPackBasic {
|
| | | public byte ActNum; // 活动编号
|
| | | public string StartDate; // 开始日期 y-m-d
|
| | | public string EndtDate; // 结束日期 y-m-d
|
| | | public byte ResetType; // 重置类型,0-0点重置;1-5点重置
|
| | | public ushort LimitLV; // 限制等级
|
| | | public byte TreasureType; // 活动寻宝类型
|
| | |
|
| | | public HAA87_tagMCActYunshiInfo () {
|
| | | _cmd = (ushort)0xAA87;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out ActNum, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out StartDate, vBytes, NetDataType.Chars, 10);
|
| | | TransBytes (out EndtDate, vBytes, NetDataType.Chars, 10);
|
| | | TransBytes (out ResetType, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out LimitLV, vBytes, NetDataType.WORD);
|
| | | TransBytes (out TreasureType, vBytes, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6a4b1f75e1daf37408729163577e12ab |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | using System;
|
| | | using LitJson;
|
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using System.Text;
|
| | |
|
| | | using LitJson;
|
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | |
| | | }
|
| | | SetXBFuncDict(GatheringSoulModel.xbType);
|
| | |
|
| | |
|
| | | SetXBFuncDict(105);
|
| | | SetXBFuncDict(106);
|
| | | SetXBFuncDict(107);
|
| | | SetXBFuncDict(108);
|
| | | SysNotifyMgr.Instance.RegisterCondition("HappyXB", SatisfyNotifyCondition);
|
| | |
|
| | | XBCostTypeDict.Clear();
|
| | |
| | | XBCostTypeDict[(int)HappXBTitle.Gubao1 + i] = TreasureSetConfig.Get(type).CostMoneyType;
|
| | | }
|
| | | XBCostTypeDict[(int)HappXBTitle.GatherSoul] = TreasureSetConfig.Get(GatheringSoulModel.xbType).CostMoneyType;
|
| | | XBCostTypeDict[(int)HappXBTitle.YunShi1] = TreasureSetConfig.Get(105).CostMoneyType;
|
| | | XBCostTypeDict[(int)HappXBTitle.YunShi2] = TreasureSetConfig.Get(106).CostMoneyType;
|
| | | XBCostTypeDict[(int)HappXBTitle.YunShi3] = TreasureSetConfig.Get(107).CostMoneyType;
|
| | | XBCostTypeDict[(int)HappXBTitle.YunShi4] = TreasureSetConfig.Get(108).CostMoneyType;
|
| | | }
|
| | |
|
| | |
|
| | |
| | | funcSet.xbType = type;
|
| | | funcSet.xbNums = treasureSetCfg.TreasureCountList;
|
| | |
|
| | | funcSet.xbPrices = treasureSetCfg.CostMoneyList;
|
| | | funcSet.xbPrices = treasureSetCfg.CostMoneyList;
|
| | |
|
| | | funcSet.costToolIds = new int[] { treasureSetCfg.CostItemID, treasureSetCfg.CostItemID };
|
| | | funcSet.costToolNums = treasureSetCfg.CostItemCountList;
|
| | |
| | | typeInfo.luckValue = info.TreasuerInfoList[i].LuckValue;
|
| | | typeInfo.freeCountToday = info.TreasuerInfoList[i].FreeCountToday;
|
| | | typeInfo.treasureCount = (int)info.TreasuerInfoList[i].TreasureCount;
|
| | | typeInfo.treasureCntAward = (int)info.TreasuerInfoList[i].TreasureCntAward;
|
| | | if (typeInfo.gridLimitCntDict == null)
|
| | | typeInfo.gridLimitCntDict = new Dictionary<int, int>();
|
| | | for (int j = 0; j < info.TreasuerInfoList[i].GridLimitCntList.Length; j++)
|
| | | {
|
| | | int num = info.TreasuerInfoList[i].GridLimitCntList[j].GridNum;
|
| | | int cnt = info.TreasuerInfoList[i].GridLimitCntList[j].GridCnt;
|
| | | typeInfo.gridLimitCntDict[num] = cnt;
|
| | | }
|
| | | xbTypeInfoDict.Add(info.TreasuerInfoList[i].TreasureType, typeInfo);
|
| | | }
|
| | | else
|
| | |
| | | xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].luckValue = info.TreasuerInfoList[i].LuckValue;
|
| | | xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].freeCountToday = info.TreasuerInfoList[i].FreeCountToday;
|
| | | xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].treasureCount = (int)info.TreasuerInfoList[i].TreasureCount;
|
| | | xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].treasureCntAward = (int)info.TreasuerInfoList[i].TreasureCntAward;
|
| | | if (xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].gridLimitCntDict == null)
|
| | | xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].gridLimitCntDict = new Dictionary<int, int>();
|
| | | for (int j = 0; j < info.TreasuerInfoList[i].GridLimitCntList.Length; j++)
|
| | | {
|
| | | int num = info.TreasuerInfoList[i].GridLimitCntList[j].GridNum;
|
| | | int cnt = info.TreasuerInfoList[i].GridLimitCntList[j].GridCnt;
|
| | | xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].gridLimitCntDict[num] = cnt;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | public void SendXBManyQuest(PackType type, int xbType)
|
| | | {
|
| | | var funcSet = GetXBFuncSet(xbType);
|
| | |
| | | int toolCnt = 0;
|
| | | int needToolCnt = 0;
|
| | | int needMoney = 0;
|
| | | if (IsHaveManyXBToolEx(xbType, out toolCnt, out needToolCnt, out needMoney))
|
| | | if (IsHaveManyXBToolEx(xbType, out toolCnt, out needToolCnt, out needMoney))
|
| | | {
|
| | | if (toolCnt >= needToolCnt)
|
| | | {
|
| | |
| | | m_storeModel.UseMoneyCheck(xbManyMoney, () =>
|
| | | {
|
| | | SendXBQuest(xbType, 1, toolCnt > 0 ? 2 : 0);
|
| | | }, xbType == 1 ? 5:6, fullTip: Language.Get("TreasurePavilion08", xbManyMoney, moneyType, funcSet.costToolIds[1], needToolCnt - toolCnt));
|
| | | }, xbType == 1 ? 5 : 6, fullTip: Language.Get("TreasurePavilion08", xbManyMoney, moneyType, funcSet.costToolIds[1], needToolCnt - toolCnt));
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | public int luckValue;
|
| | | public int freeCountToday; //今日已免费寻宝次数
|
| | | public int treasureCount; //已寻宝总次数
|
| | | public int treasureCntAward; //累计寻宝次数对应奖励领奖状态,按奖励记录索引二进制记录是否已领取
|
| | | public Dictionary<int, int> gridLimitCntDict; //<有限制抽取次数的格子编号,已抽到次数> 有限制抽取次数的格子次数信息
|
| | | }
|
| | |
|
| | | public class XBFuncSet
|
| | |
| | | Gubao2 = 6,
|
| | | Gubao3 = 7,
|
| | | Gubao4 = 8,
|
| | | |
| | | YunShi1 = 105,
|
| | | YunShi2 = 106,
|
| | | YunShi3 = 107,
|
| | | YunShi4 = 108,
|
| | | }
|
| | | }
|
New file |
| | |
| | | using UnityEngine;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class CommonGetItem : MonoBehaviour
|
| | | {
|
| | | [SerializeField] ItemCell itemCell;
|
| | | [SerializeField] TextEx txtItemName;
|
| | |
|
| | | public void Display(int itemID)
|
| | | {
|
| | | txtItemName.SetActive(ItemLogicUtility.Instance.isNameShow);
|
| | | if (!ItemLogicUtility.Instance.totalShowItems.ContainsKey(itemID))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | var item = ItemLogicUtility.Instance.totalShowItems[itemID];
|
| | | itemCell.Init(new ItemCellModel(itemID, false, item.countEx));
|
| | | txtItemName.text = ItemConfig.Get(itemID).ItemName;
|
| | | itemCell.button.SetListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemID);
|
| | | });
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a3ae06d9569376243ac7d6912a2bf715 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class CommonGetItemCell : CellView
|
| | | {
|
| | | [SerializeField] ItemCell itemCell;
|
| | | [SerializeField] TextEx txtItemName;
|
| | |
|
| | | public void Display(int itemID)
|
| | | [SerializeField] List<CommonGetItem> commonGetItems = new List<CommonGetItem>();
|
| | | [SerializeField] HorizontalLayoutGroup horizontalLayout;
|
| | | public void Display(int rowIndex)
|
| | | {
|
| | | txtItemName.SetActive(ItemLogicUtility.Instance.isNameShow);
|
| | | if (!ItemLogicUtility.Instance.totalShowItems.ContainsKey(itemID))
|
| | | {
|
| | | return;
|
| | | }
|
| | | var dict = ItemLogicUtility.Instance.totalShowItems;
|
| | | var list = dict.Keys.ToList();
|
| | | int rowCount = (int)Mathf.Ceil((float)list.Count / 5);
|
| | | horizontalLayout.childAlignment= rowCount > 1?TextAnchor.MiddleLeft: TextAnchor.MiddleCenter;
|
| | |
|
| | | var item = ItemLogicUtility.Instance.totalShowItems[itemID];
|
| | | itemCell.Init(new ItemCellModel(itemID, false, item.countEx));
|
| | | txtItemName.text = ItemConfig.Get(itemID).ItemName;
|
| | | itemCell.button.SetListener(() => {
|
| | | ItemTipUtility.Show(itemID);
|
| | | });
|
| | | for (int i = 0; i < commonGetItems.Count; i++)
|
| | | {
|
| | | int index = rowIndex * 5 + i;
|
| | | if (index < list.Count)
|
| | | {
|
| | | int itemId = list[index];
|
| | | commonGetItems[i].Display(itemId);
|
| | | commonGetItems[i].SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | commonGetItems[i].SetActive(false);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
| | |
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | |
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | sureBtn.AddListener(() => {
|
| | | sureBtn.AddListener(() =>
|
| | | {
|
| | |
|
| | | CloseClick();
|
| | | });
|
| | |
| | | {
|
| | | scroller.Refresh();
|
| | | var keys = ItemLogicUtility.Instance.totalShowItems.Keys.ToList();
|
| | | for (int i = 0; i < keys.Count; i++)
|
| | | int rowCount = (int)Mathf.Ceil((float)keys.Count / 5);
|
| | | for (int i = 0; i < rowCount; i++)
|
| | | {
|
| | | scroller.AddCell(ScrollerDataType.Header, keys[i]);
|
| | | scroller.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | | scroller.Restart();
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 686053908b31ba64698104f7142b617f |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | namespace vnxbqy.UI
|
| | | {
|
| | | //轮回殿活动
|
| | | public class OperationYunShi : OperationBase
|
| | | {
|
| | | public int treasureType;
|
| | |
|
| | | public override bool SatisfyOpenCondition()
|
| | | {
|
| | | return PlayerDatas.Instance.baseData.LV >= limitLv;
|
| | | }
|
| | |
|
| | | public override string ToDisplayTime()
|
| | | {
|
| | | var textBuilder = OperationTimeHepler.textBuilder;
|
| | | textBuilder.Length = 0;
|
| | | textBuilder.Append(startDate.ToDisplay(false));
|
| | | textBuilder.Append(string.Format(" {0}:{1}", joinStartHour.ToString("D2"), joinStartMinute.ToString("D2")));
|
| | | if (startDate != endDate)
|
| | | {
|
| | | textBuilder.Append(" - ");
|
| | | textBuilder.Append(endDate.ToDisplay(false));
|
| | | textBuilder.Append(string.Format(" {0}:{1}", joinEndHour.ToString("D2"), joinEndMinute.ToString("D2")));
|
| | | }
|
| | | return textBuilder.ToString();
|
| | | }
|
| | |
|
| | | public override void Reset()
|
| | | {
|
| | | base.Reset();
|
| | | treasureType = 0;
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 8cb63278a33c6304180dd55e64ac766e |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace vnxbqy.UI |
| | | {
|
| | | public class YunShiCoolTime : 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.default48); |
| | | 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: c11a373cf92e67a42be9abcd053a4297 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class YunShiMissionActCell : CellView
|
| | | {
|
| | | [SerializeField] TextEx txtMission;
|
| | | [SerializeField] List<ItemCell> itemCells;
|
| | | [SerializeField] ButtonEx btnGetGift;
|
| | | [SerializeField] ImageEx imgGetYet;
|
| | | [SerializeField] ButtonEx btnGo;
|
| | |
|
| | | YunShiMissionActModel model { get { return ModelCenter.Instance.GetModel<YunShiMissionActModel>(); } }
|
| | |
|
| | | public void Display(int id)
|
| | | {
|
| | | OperationMissionAct missionAct;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiMissionActModel.operaType, out missionAct);
|
| | | if (missionAct == null)
|
| | | return;
|
| | | var mission = missionAct.missionInfo[id];
|
| | | txtMission.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);
|
| | | btnGo.SetActive(state == 0);
|
| | | btnGo.SetListener(() =>
|
| | | {
|
| | | WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)model.missionJumpIDs[mission.TaskType]);
|
| | | });
|
| | | btnGetGift.SetActive(state == 1);
|
| | | btnGetGift.SetListener(() =>
|
| | | {
|
| | | GetAllAward();
|
| | | });
|
| | | imgGetYet.SetActive(state == 2);
|
| | | }
|
| | |
|
| | | //一键领取并且 提前展示奖励
|
| | | private void GetAllAward()
|
| | | {
|
| | | List<Item> items = new List<Item>();
|
| | | OperationMissionAct missionAct;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiMissionActModel.operaType, out missionAct);
|
| | | if (missionAct == null)
|
| | | return;
|
| | | var keys = missionAct.missionInfo.Keys.ToList();
|
| | | foreach (var id in keys)
|
| | | {
|
| | | var state = model.GetMissionAwardState(id);
|
| | | if (state == 1)
|
| | | {
|
| | | model.SendGetAward(id);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: dafc134337ad018458794f19e367c343 |
| | | 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;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class YunShiMissionActModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity
|
| | | {
|
| | | public event Action<int> onStateUpdate;
|
| | | public Redpoint redPoint = new Redpoint(MainRedDot.YunShiRepoint, MainRedDot.YunShiRepoint * 10 + 2); //可能挂多个父红点
|
| | |
|
| | | 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.YunShiMissionAct;
|
| | | public static Operation operaType = Operation.default49;
|
| | |
|
| | | public int actNum = 12; //对应界面
|
| | | 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)
|
| | | {
|
| | | if (onStateUpdate != null)
|
| | | {
|
| | | onStateUpdate(activityID);
|
| | | }
|
| | | UpdateRedpoint();
|
| | | if (WindowCenter.Instance.IsOpen<YunShiWin>())
|
| | | {
|
| | | WindowCenter.Instance.Close<YunShiWin>();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | 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: 2eb16e0d3fd8fe243bd266ce1b4caa2b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class YunShiMissionActWin : Window
|
| | | {
|
| | | [SerializeField] ScrollerController scroller;
|
| | | [SerializeField] TextEx actTime;
|
| | | YunShiMissionActModel model { get { return ModelCenter.Instance.GetModel<YunShiMissionActModel>(); } }
|
| | |
|
| | | #region Built-in
|
| | |
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | scroller.OnRefreshCell += OnRefreshCell;
|
| | | model.UpdateMissionEvent += UpdateMissionEvent;
|
| | | GlobalTimeEvent.Instance.secondEvent += secondEvent;
|
| | | DisplayScroll();
|
| | | secondEvent();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | scroller.OnRefreshCell -= OnRefreshCell;
|
| | | model.UpdateMissionEvent -= UpdateMissionEvent;
|
| | | GlobalTimeEvent.Instance.secondEvent -= secondEvent;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | private void DisplayScroll()
|
| | | {
|
| | | scroller.Refresh();
|
| | | OperationMissionAct missionAct;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiMissionActModel.operaType, out missionAct);
|
| | | if (missionAct == null)
|
| | | return;
|
| | | var keys = missionAct.missionInfo.Keys.ToList();
|
| | | keys.Sort(CmpState);
|
| | | for (int i = 0; i < keys.Count; i++)
|
| | | {
|
| | | scroller.AddCell(ScrollerDataType.Header, keys[i]);
|
| | | }
|
| | | scroller.Restart();
|
| | | scroller.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | | //可领取 - 未完成 - 已领取
|
| | | 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 YunShiMissionActCell;
|
| | |
|
| | | _cell.Display(_cell.index);
|
| | | }
|
| | |
|
| | | private void UpdateMissionEvent(bool isNewRound)
|
| | | {
|
| | | OperationMissionAct missionAct;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiMissionActModel.operaType, out missionAct);
|
| | | if (missionAct == null)
|
| | | return;
|
| | |
|
| | | if (isNewRound)
|
| | | {
|
| | | DisplayScroll();
|
| | | }
|
| | | else
|
| | | {
|
| | | scroller.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | | }
|
| | |
|
| | | private void secondEvent()
|
| | | {
|
| | | OperationMissionAct missionAct;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiMissionActModel.operaType, out missionAct);
|
| | | if (missionAct == null)
|
| | | return;
|
| | | actTime.text = Language.Get("YunShi02", TimeUtility.SecondsToDHMSCHS(missionAct.GetResetSurplusTime()));
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4fa4a5350c25d8b4cb5855c522c03fe5 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class YunShiRechargeGiftActCell : CellView
|
| | | {
|
| | | [SerializeField] TextEx txtTitle;
|
| | |
|
| | | [SerializeField] List<CustomizedItemCell> itemCells;
|
| | | [SerializeField] ButtonEx btnBuy;
|
| | | [SerializeField] TextEx txtPrice;
|
| | | [SerializeField] ImageEx imgBuyYet;
|
| | | [SerializeField] ImageEx imgProfitRatio;
|
| | | [SerializeField] TextEx txtProfitRatio;
|
| | | [SerializeField] TextEx txtLimitCount;
|
| | | [SerializeField] ImageEx imgRed;
|
| | | [SerializeField] TextEx orgPrice;
|
| | |
|
| | | YunShiRechargeGiftActModel model { get { return ModelCenter.Instance.GetModel<YunShiRechargeGiftActModel>(); } }
|
| | | 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(YunShiRechargeGiftActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return;
|
| | | imgRed.SetActive(false);
|
| | |
|
| | | 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);
|
| | | txtTitle.text = ctgConfig.Title;
|
| | |
|
| | | var countInfo = model.GetBuyCntInfo(ctgID);
|
| | |
|
| | | int buyCnt = countInfo.x;
|
| | | int totalCnt = countInfo.y;
|
| | |
|
| | | customizedRechargeModel.ShowUIItems(itemCells, ctgID);
|
| | |
|
| | | btnBuy.SetActive(buyCnt < totalCnt);
|
| | | btnBuy.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);
|
| | | }
|
| | | });
|
| | | imgBuyYet.SetActive(buyCnt >= totalCnt);
|
| | |
|
| | | OrderInfoConfig orderConfig;
|
| | | vipModel.TryGetOrderInfo(ctgID, out orderConfig);
|
| | | imgProfitRatio.SetActive(orderConfig != null);
|
| | | txtPrice.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(orderConfig.PayRMBNum));
|
| | | txtLimitCount.SetActive(true);
|
| | | txtLimitCount.text = Language.Get("YunShi03", UIHelper.AppendColor(buyCnt >= totalCnt ? TextColType.Red : TextColType.DarkGreen, Mathf.Max(0, totalCnt - buyCnt).ToString(), true));
|
| | |
|
| | | if (orgPrice != null)
|
| | | {
|
| | | orgPrice.SetActive(PlayerDatas.Instance.baseData.IsActive90Off);
|
| | | orgPrice.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(orderConfig.m_PayRMBNum));
|
| | | }
|
| | |
|
| | | txtProfitRatio.text = Language.Get("BlessedLand039", ctgConfig.Percentage);
|
| | | }
|
| | |
|
| | | private void DisplayStore(StoreConfig storeConfig)
|
| | | {
|
| | | bool isFree = storeConfig.MoneyNumber == 0;
|
| | | txtTitle.text = isFree ? Language.Get("StoreName_free") : Language.Get("StoreName_money");
|
| | | imgRed.SetActive(isFree);
|
| | | orgPrice.SetActive(false);
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | | btnBuy.SetActive(remainNum > 0);
|
| | | btnBuy.SetListener(() =>
|
| | | {
|
| | | storeModel.SendBuyShopItemWithPopCheck(storeConfig, 1, (int)BuyStoreItemCheckType.ActGift);
|
| | | });
|
| | | imgBuyYet.SetActive(remainNum <= 0);
|
| | |
|
| | | txtPrice.text = isFree ? Language.Get("AloneFree") : Language.Get("ItemOverdue105", storeConfig.MoneyNumber);
|
| | | imgProfitRatio.SetActive(false);
|
| | | txtLimitCount.SetActive(!isFree);
|
| | | txtLimitCount.text = Language.Get("CycleHall06", UIHelper.AppendColor(remainNum == 0 ? TextColType.Red : TextColType.DarkGreen, Mathf.Max(0, remainNum).ToString(), true));
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 7cde93be42d1c7244a635093af9271f5 |
| | | 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 YunShiRechargeGiftActModel : 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.YunShiRepoint, MainRedDot.YunShiRepoint * 10 + 3); //可能挂多个父红点
|
| | |
|
| | | private int GiftAwardRecord; //领取状态
|
| | |
|
| | | public const int activityType = (int)OpenServerActivityCenter.ActivityType.AT_Activity2;
|
| | | public const int activityID = (int)NewDayActivityID.YunShiRechargeGiftAct;
|
| | | public static Operation operaType = Operation.default50;
|
| | |
|
| | | public const int actNum = 12; //对应界面
|
| | | 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);
|
| | | }
|
| | |
|
| | | 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)
|
| | | {
|
| | | if (onStateUpdate != null)
|
| | | {
|
| | | onStateUpdate(activityID);
|
| | | }
|
| | | UpdateRedpoint();
|
| | | if (WindowCenter.Instance.IsOpen<YunShiWin>())
|
| | | {
|
| | | WindowCenter.Instance.Close<YunShiWin>();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | 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)
|
| | | {
|
| | | 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: 6abe00b16417414438edcd021757aab3 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class YunShiRechargeGiftActWin : Window
|
| | | {
|
| | | [SerializeField] ScrollerController scroller;
|
| | | [SerializeField] TextEx actTime;
|
| | | YunShiRechargeGiftActModel model { get { return ModelCenter.Instance.GetModel<YunShiRechargeGiftActModel>(); } }
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
| | |
|
| | | StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
|
| | |
|
| | | #region Built-in
|
| | |
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | scroller.OnRefreshCell += OnRefreshCell;
|
| | | GlobalTimeEvent.Instance.secondEvent += secondEvent;
|
| | | vipModel.rechargeCountEvent += VipModel_rechargeCountEvent;
|
| | | storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent;
|
| | | DisplayScroll();
|
| | | secondEvent();
|
| | | }
|
| | |
|
| | | private void VipModel_rechargeCountEvent(int obj)
|
| | | {
|
| | | scroller.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | scroller.OnRefreshCell -= OnRefreshCell;
|
| | | GlobalTimeEvent.Instance.secondEvent -= secondEvent;
|
| | | vipModel.rechargeCountEvent -= VipModel_rechargeCountEvent;
|
| | | storeModel.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | private void RefreshBuyShopLimitEvent()
|
| | | {
|
| | | scroller.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | | private void DisplayScroll()
|
| | | {
|
| | | scroller.Refresh();
|
| | | OperationRechargeGiftAct act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiRechargeGiftActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return;
|
| | | 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++)
|
| | | {
|
| | | scroller.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | | scroller.Restart();
|
| | | scroller.m_Scorller.RefreshActiveCellViews();
|
| | | scroller.JumpIndex(GetDefaultSelect());
|
| | | }
|
| | |
|
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | if (type != ScrollerDataType.Header) return;
|
| | |
|
| | | var _cell = cell as YunShiRechargeGiftActCell;
|
| | |
|
| | | _cell.Display(_cell.index);
|
| | | }
|
| | |
|
| | | private int GetDefaultSelect()
|
| | | {
|
| | | OperationRechargeGiftAct act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiRechargeGiftActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return 0;
|
| | |
|
| | | 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()
|
| | | {
|
| | | OperationRechargeGiftAct act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiRechargeGiftActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return;
|
| | | actTime.text = Language.Get("RidingPetBossQuestTime", act.ToDisplayTimeEx());
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: dce6317f8b4d34d429bdde61ba1983a6 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | |
| | | namespace vnxbqy.UI |
| | | { |
| | | // 运势 |
| | | public class YunShiWin : Window |
| | | { |
| | | [SerializeField] FunctionButton btnXB; |
| | | [SerializeField] FunctionButton btnTask; |
| | | [SerializeField] FunctionButton btnGift; |
| | | [SerializeField] FunctionButtonGroup buttonGroup; |
| | | [SerializeField] ImageEx imgTitle; |
| | | [SerializeField] ButtonEx btnClose; |
| | |
|
| | | #region Built-in |
| | |
|
| | | protected override void AddListeners() |
| | | { |
| | | btnXB.SetListener(OnXB); |
| | | btnTask.SetListener(OnTask); |
| | | btnGift.SetListener(OnGift); |
| | | btnClose.SetListener(CloseClick); |
| | | } |
| | | |
| | | protected override void BindController() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | ChangeTabShow(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | }
|
| | |
|
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnActived() |
| | | { |
| | | base.OnActived(); |
| | | buttonGroup.TriggerByOrder(functionOrder); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | public void OnXB() |
| | | { |
| | | CloseChildWin(); |
| | | WindowCenter.Instance.Open<YunShiXBActWin>(); |
| | | functionOrder = 0; |
| | | ChangeTabShow(); |
| | | } |
| | | |
| | | public void OnTask() |
| | | { |
| | | CloseChildWin(); |
| | | WindowCenter.Instance.Open<YunShiMissionActWin>(); |
| | | functionOrder = 2; |
| | | ChangeTabShow(); |
| | | } |
| | | |
| | | public void OnGift() |
| | | { |
| | | CloseChildWin(); |
| | | functionOrder = 1; |
| | | WindowCenter.Instance.Open<YunShiRechargeGiftActWin>(); |
| | | ChangeTabShow(); |
| | | } |
| | | |
| | | private void CloseChildWin() |
| | | { |
| | | var children = WindowConfig.GetChildWindows("YunShiWin"); |
| | | foreach (var window in children) |
| | | { |
| | | WindowCenter.Instance.Close(window); |
| | | } |
| | | } |
| | | |
| | | private void ChangeTabShow() |
| | | { |
| | | ChangeTabChooseShow(); |
| | | ChangeTitleShow(); |
| | | } |
| | | |
| | | private void ChangeTabChooseShow() |
| | | { |
| | | btnXB.state = btnXB.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal; |
| | | btnXB.image.SetNativeSize(); |
| | | |
| | | btnTask.state = btnTask.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal; |
| | | btnTask.image.SetNativeSize(); |
| | | |
| | | btnGift.state = btnGift.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal; |
| | | btnGift.image.SetNativeSize(); |
| | | } |
| | | |
| | | private void ChangeTitleShow() |
| | | { |
| | | OperationYunShi act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiXBActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return; |
| | | int treasureType = act.treasureType; |
| | | if (!TreasureSetConfig.Has(treasureType)) |
| | | return; |
| | | imgTitle.SetSprite(StringUtility.Contact("YunShiTitle_" + treasureType)); |
| | | imgTitle.SetNativeSize(); |
| | | }
|
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 63c72b69b63ff654db10f6b453db8c7b |
| | | 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;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class YunShiXBActModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity
|
| | | {
|
| | | public event Action<int> onStateUpdate;
|
| | | public Redpoint redPoint = new Redpoint(MainRedDot.YunShiRepoint);
|
| | | public Redpoint redPointTab = new Redpoint(MainRedDot.YunShiRepoint, MainRedDot.YunShiRepoint * 10 + 1); //可能挂多个父红点
|
| | | public const int activityType = (int)OpenServerActivityCenter.ActivityType.AT_Activity2;
|
| | | public const int activityID = (int)NewDayActivityID.YunShiXBAct;
|
| | | public static Operation operaType = Operation.default48;
|
| | |
|
| | | //<寻宝类型,<格子编号,格子背景编号>>
|
| | | public Dictionary<int, Dictionary<int, int>> itemBgDict = new Dictionary<int, Dictionary<int, int>>();
|
| | |
|
| | | //默认格子背景 索引0是有限量格子的背景 索引1是普通格子的背景
|
| | | public List<int> defaultBgList = new List<int>();
|
| | |
|
| | | //<寻宝类型,<物品id,格子背景编号>>
|
| | | public Dictionary<int, Dictionary<int, int>> itemIdBgDict = new Dictionary<int, Dictionary<int, int>>();
|
| | |
|
| | | public int actNum = 10; //对应界面
|
| | | public event Action<bool> UpdateMissionEvent;
|
| | | public readonly int AwardCellCount = 5;
|
| | |
|
| | | //同步播放摆动动画
|
| | | public Action PlayAnimationSync;
|
| | |
|
| | | private bool isPlayAnimation = false;
|
| | | public bool IsPlayAnimation
|
| | | {
|
| | | get
|
| | | {
|
| | | return isPlayAnimation;
|
| | | }
|
| | | set
|
| | | {
|
| | | isPlayAnimation = value;
|
| | | if (isPlayAnimation)
|
| | | {
|
| | | PlayAnimationSync?.Invoke();
|
| | | }
|
| | | isPlayAnimation = false;
|
| | | }
|
| | | }
|
| | | public bool isSkipXB { get; set; }
|
| | |
|
| | | HappyXBModel happyXBModel { get { return ModelCenter.Instance.GetModelEx<HappyXBModel>(); } }
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
|
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
|
| | | OperationTimeHepler.Instance.operationAdvanceEvent += OperationAdvanceEvent;
|
| | | happyXBModel.RefreshXBTypeInfoAct += OnRefreshXBTypeInfoAct;
|
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent += OnOperationTimeUpdateEvent;
|
| | | OpenServerActivityCenter.Instance.Register(activityID, this, activityType);
|
| | |
|
| | | var jsonData = JsonMapper.ToObject(FuncConfigConfig.Get("YunShi").Numerical1);
|
| | | var keyList = jsonData.Keys.ToList();
|
| | | for (int i = 0; i < keyList.Count; i++)
|
| | | {
|
| | | int type = int.Parse(keyList[i]);
|
| | | if (!itemBgDict.ContainsKey(type))
|
| | | itemBgDict[type] = new Dictionary<int, int>();
|
| | | if (!itemIdBgDict.ContainsKey(type))
|
| | | itemIdBgDict[type] = new Dictionary<int, int>();
|
| | |
|
| | | var arr = JsonMapper.ToObject<int[][]>(jsonData[keyList[i]].ToJson());
|
| | | if (type == 0)
|
| | | {
|
| | | defaultBgList.Add(arr[0][0]);
|
| | | defaultBgList.Add(arr[0][1]);
|
| | | }
|
| | | else
|
| | | {
|
| | | for (int j = 0; j < arr.Length; j++)
|
| | | {
|
| | | itemBgDict[type][arr[j][0]] = arr[j][1];
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | WindowCenter.Instance.uiRoot.eventSystem.enabled = true;
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | happyXBModel.RefreshXBTypeInfoAct -= OnRefreshXBTypeInfoAct;
|
| | | OperationTimeHepler.Instance.operationTimeUpdateEvent -= OnOperationTimeUpdateEvent;
|
| | | }
|
| | |
|
| | | private void OnOperationTimeUpdateEvent(Operation operation)
|
| | | {
|
| | | UpdateRedPoint();
|
| | | }
|
| | |
|
| | | private void OnRefreshXBTypeInfoAct()
|
| | | {
|
| | | 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)
|
| | | {
|
| | | if (onStateUpdate != null)
|
| | | {
|
| | | onStateUpdate(activityID);
|
| | | }
|
| | | UpdateRedPoint();
|
| | | if (WindowCenter.Instance.IsOpen<YunShiWin>())
|
| | | {
|
| | | WindowCenter.Instance.Close<YunShiWin>();
|
| | | }
|
| | | WindowCenter.Instance.uiRoot.eventSystem.enabled = true;
|
| | | }
|
| | | }
|
| | |
|
| | | 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);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateRedPoint()
|
| | | {
|
| | | redPointTab.state = RedPointState.None;
|
| | |
|
| | | OperationYunShi act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiXBActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return;
|
| | |
|
| | | int type = act.treasureType;
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return;
|
| | |
|
| | | var award = TreasureCntAwardConfig.GetAwardIndexDict(type);
|
| | | if (award == null)
|
| | | return;
|
| | |
|
| | | var list = award.Keys.ToList();
|
| | | list.Sort();
|
| | | if (list == null)
|
| | | return;
|
| | | //有奖励未领取
|
| | | for (int i = 0; i < AwardCellCount; i++)
|
| | | {
|
| | | if (i < list.Count)
|
| | | {
|
| | | int id = award[list[i]];
|
| | | if (!TreasureCntAwardConfig.Has(id))
|
| | | continue;
|
| | | TreasureCntAwardConfig config = TreasureCntAwardConfig.Get(id);
|
| | | int state = GetAwardState(xbInfo.treasureCount, config.NeedTreasureCnt, xbInfo.treasureCntAward, config.AwardIndex);
|
| | | if (state == 1)
|
| | | {
|
| | | redPointTab.state = RedPointState.Simple;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public bool TryGetItemBG(int type, int gridIndex, bool isLimit, out string str)
|
| | | {
|
| | | str = string.Empty;
|
| | | if (!itemBgDict.TryGetValue(type, out var dict))
|
| | | return false;
|
| | | if (!dict.TryGetValue(gridIndex, out var num))
|
| | | {
|
| | | if (defaultBgList == null)
|
| | | return false;
|
| | | str = StringUtility.Contact("YunShiXBItemBG_", isLimit ? defaultBgList[0] : defaultBgList[1]);
|
| | | return true;
|
| | | }
|
| | | else
|
| | | {
|
| | | str = StringUtility.Contact("YunShiXBItemBG_", num);
|
| | | return true;
|
| | | }
|
| | | }
|
| | |
|
| | | Dictionary<int, int> xbLimitMaxCountDict = new Dictionary<int, int>();
|
| | |
|
| | | public Dictionary<int, int> GetXbLimitMaxCountDict(string GridNumMaxLimitInfo)
|
| | | {
|
| | | if (xbLimitMaxCountDict.IsNullOrEmpty())
|
| | | {
|
| | | var jsonData = JsonMapper.ToObject(GridNumMaxLimitInfo);
|
| | | var keyList = jsonData.Keys.ToList();
|
| | | for (int j = 0; j < keyList.Count; j++)
|
| | | {
|
| | | string key = keyList[j];
|
| | | int value = int.Parse(jsonData[key].ToJson());
|
| | | xbLimitMaxCountDict[int.Parse(key)] = value;
|
| | | }
|
| | | }
|
| | | return xbLimitMaxCountDict;
|
| | | }
|
| | |
|
| | | //0 不可领取 1 可领取 2 已领取
|
| | | public int GetAwardState(int nowCnt, int needCnt, int treasureCntAward, int index)
|
| | | {
|
| | | if (nowCnt < needCnt)
|
| | | return 0;
|
| | | return ((int)Math.Pow(2, index) & treasureCntAward) == 0 ? 1 : 2;
|
| | | }
|
| | |
|
| | | public void SendGetAward(int type, int count)
|
| | | {
|
| | | CA504_tagCMPlayerGetReward getReward = new CA504_tagCMPlayerGetReward();
|
| | | getReward.RewardType = 77;
|
| | | getReward.DataEx = (uint)type;
|
| | | getReward.DataExStr = count.ToString();
|
| | | getReward.DataExStrLen = (byte)getReward.DataExStr.Length;
|
| | | GameNetSystem.Instance.SendInfo(getReward);
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1a36cc81c9e2f93419823f2ad8372195 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using DG.Tweening;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class YunShiXBActWin : Window
|
| | | {
|
| | | [SerializeField] List<Transform> startItems;//所有气泡起始坐标
|
| | | [SerializeField] Transform transStartQianTong;//签筒起始坐标
|
| | | [SerializeField] List<Transform> transStartQian;//所有签子起始坐标
|
| | |
|
| | | [SerializeField] List<YunShiXBItem> yunShiXBItems;//所有气泡
|
| | | [SerializeField] Transform transQianTong;//ǩͲ
|
| | | [SerializeField] List<Transform> transQian;//所有签子
|
| | |
|
| | | [SerializeField] Transform oneEnd;//单抽气泡目的地坐标
|
| | | [SerializeField] List<Transform> manyEnds;//多抽气泡目的地坐标
|
| | |
|
| | | [SerializeField] Transform transItemMissEnd;//所有气泡消失点目的地坐标
|
| | | [SerializeField] Transform transQianTongMissEnd;//签筒目的地坐标
|
| | |
|
| | | [SerializeField] List<PositionTween> qianPositionTweens = new List<PositionTween>();
|
| | | [SerializeField] RotationTween qianTongRotationTween;
|
| | | [SerializeField] UIEffect qianTongUIEffect;
|
| | | [SerializeField] List<UIEffect> haveUIEffects;
|
| | |
|
| | | [SerializeField] TextEx actTime;
|
| | | [SerializeField] ButtonEx btnXBOne;
|
| | | [SerializeField] ButtonEx btnXBMany;
|
| | | [SerializeField] ButtonEx btnRate;
|
| | | [SerializeField] TextEx txtXBOne;
|
| | | [SerializeField] TextEx txtXBMany;
|
| | | [SerializeField] TextEx txtXBOneCount;
|
| | | [SerializeField] TextEx txtXBManyCount;
|
| | | [SerializeField] ButtonEx btnSkip;
|
| | | [SerializeField] ImageEx imgSkip;
|
| | |
|
| | | [SerializeField] TextEx txtHasCnt;
|
| | | [SerializeField] List<Slider> sliders = new List<Slider>();
|
| | | [SerializeField] List<ItemCell> itemCells = new List<ItemCell>();
|
| | | [SerializeField] List<ImageEx> imgGreys = new List<ImageEx>();
|
| | | [SerializeField] List<ImageEx> imgHaves = new List<ImageEx>();
|
| | | [SerializeField] List<TextEx> needCnts = new List<TextEx>();
|
| | | [SerializeField] List<RotationTween> awardRotationTweens = new List<RotationTween>();
|
| | |
|
| | | int type;
|
| | | HappyXBModel happyXBModel { get { return ModelCenter.Instance.GetModelEx<HappyXBModel>(); } }
|
| | | YunShiXBActModel model { get { return ModelCenter.Instance.GetModelEx<YunShiXBActModel>(); } }
|
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | btnSkip.SetListener(() =>
|
| | | {
|
| | | model.isSkipXB = !model.isSkipXB;
|
| | | RefreshSkipUI();
|
| | | });
|
| | |
|
| | | btnRate.SetListener(() =>
|
| | | {
|
| | | WindowCenter.Instance.Open<YunShiXBProbabilityWin>();
|
| | | });
|
| | |
|
| | | btnXBOne.SetListener(() =>
|
| | | {
|
| | | if (!happyXBModel.IsHaveOneXBTool(type))
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("YunShiXBAct01");
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!model.isSkipXB)
|
| | | {
|
| | | MoveAndDisappear();
|
| | | }
|
| | |
|
| | | happyXBModel.SendXBQuest(type, 0, 2);
|
| | | });
|
| | |
|
| | | btnXBMany.SetListener(() =>
|
| | | {
|
| | | int toolCnt = 0;
|
| | | int needToolCnt = 0;
|
| | | if (!happyXBModel.IsHaveManyXBTool(type, out toolCnt, out needToolCnt) || toolCnt < needToolCnt)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("YunShiXBAct01");
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!model.isSkipXB)
|
| | | {
|
| | | MoveAndDisappear();
|
| | | }
|
| | | happyXBModel.CheckXBManyLimit(0, type, 2);
|
| | | });
|
| | | }
|
| | |
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | WindowCenter.Instance.uiRoot.eventSystem.enabled = true;
|
| | | happyXBModel.RefreshXBTypeInfoAct += OnRefreshXBTypeInfoAct;
|
| | | model.PlayAnimationSync += OnPlaySyncAnimation;
|
| | | packModel.refreshItemCountEvent += OnRefreshItemCountEvent;
|
| | | happyXBModel.RefreshXBResultAct += RefreshXBResult;
|
| | |
|
| | | OperationYunShi act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiXBActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return;
|
| | |
|
| | | type = act.treasureType;
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return;
|
| | |
|
| | | if (type == 105)
|
| | | {
|
| | | happyXBModel.title = HappXBTitle.YunShi1;
|
| | | }
|
| | | else if (type == 106)
|
| | | {
|
| | | happyXBModel.title = HappXBTitle.YunShi2;
|
| | | }
|
| | | else if (type == 107)
|
| | | {
|
| | | happyXBModel.title = HappXBTitle.YunShi3;
|
| | | }
|
| | | else if (type == 108)
|
| | | {
|
| | | happyXBModel.title = HappXBTitle.YunShi4;
|
| | | }
|
| | |
|
| | | Display();
|
| | | actTime.text = StringUtility.Contact(Language.Get("RidingPetBossQuestTime", act.ToDisplayTime()), Language.Get("YunShi04"));
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | happyXBModel.RefreshXBTypeInfoAct -= OnRefreshXBTypeInfoAct;
|
| | | model.PlayAnimationSync -= OnPlaySyncAnimation;
|
| | | packModel.refreshItemCountEvent -= OnRefreshItemCountEvent;
|
| | | happyXBModel.RefreshXBResultAct -= RefreshXBResult;
|
| | | }
|
| | |
|
| | | private void RefreshXBResult()
|
| | | {
|
| | | if (model.isSkipXB)
|
| | | {
|
| | | ShowGetItem();
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnRefreshItemCountEvent(PackType type, int arg2, int arg3)
|
| | | {
|
| | | Display();
|
| | | model.IsPlayAnimation = true;
|
| | | }
|
| | |
|
| | | private void OnRefreshXBTypeInfoAct()
|
| | | {
|
| | | Display();
|
| | | model.IsPlayAnimation = true;
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | Reset();
|
| | | for (int i = 0; i < awardRotationTweens.Count; i++)
|
| | | {
|
| | | awardRotationTweens[i].Stop();
|
| | | awardRotationTweens[i].SetStartState();
|
| | | }
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return;
|
| | |
|
| | | var award = TreasureCntAwardConfig.GetAwardIndexDict(type);
|
| | | if (award == null)
|
| | | return;
|
| | |
|
| | | var list = award.Keys.ToList();
|
| | | list.Sort();
|
| | | if (list == null)
|
| | | return;
|
| | |
|
| | | for (int i = 0; i < model.AwardCellCount; i++)
|
| | | {
|
| | | if (i < list.Count)
|
| | | {
|
| | | int id = award[list[i]];
|
| | | if (!TreasureCntAwardConfig.Has(id))
|
| | | continue;
|
| | | TreasureCntAwardConfig config = TreasureCntAwardConfig.Get(id);
|
| | | int state = model.GetAwardState(xbInfo.treasureCount, config.NeedTreasureCnt, xbInfo.treasureCntAward, config.AwardIndex);
|
| | | if (state == 1)
|
| | | {
|
| | | awardRotationTweens[i].Play();
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | awardRotationTweens[i].Stop();
|
| | | awardRotationTweens[i].SetStartState();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | StopAllCoroutines();
|
| | | }
|
| | |
|
| | | private void OnPlaySyncAnimation()
|
| | | {
|
| | | for (int i = 0; i < awardRotationTweens.Count; i++)
|
| | | {
|
| | | awardRotationTweens[i].Stop();
|
| | | awardRotationTweens[i].SetStartState();
|
| | | }
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return;
|
| | |
|
| | | var award = TreasureCntAwardConfig.GetAwardIndexDict(type);
|
| | | if (award == null)
|
| | | return;
|
| | |
|
| | | var list = award.Keys.ToList();
|
| | | list.Sort();
|
| | | if (list == null)
|
| | | return;
|
| | | for (int i = 0; i < model.AwardCellCount; i++)
|
| | | {
|
| | | if (i < list.Count)
|
| | | {
|
| | | int id = award[list[i]];
|
| | | if (!TreasureCntAwardConfig.Has(id))
|
| | | continue;
|
| | | TreasureCntAwardConfig config = TreasureCntAwardConfig.Get(id);
|
| | | int state = model.GetAwardState(xbInfo.treasureCount, config.NeedTreasureCnt, xbInfo.treasureCntAward, config.AwardIndex);
|
| | | if (awardRotationTweens[i].isActiveAndEnabled && state == 1)
|
| | | {
|
| | | awardRotationTweens[i].Play();
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | awardRotationTweens[i].Stop();
|
| | | awardRotationTweens[i].SetStartState();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void Reset()
|
| | | {
|
| | | qianTongUIEffect.Stop();
|
| | |
|
| | | for (int i = 0; i < haveUIEffects.Count; i++)
|
| | | {
|
| | | haveUIEffects[i].Stop();
|
| | | }
|
| | |
|
| | | for (int i = 0; i < yunShiXBItems.Count; i++)
|
| | | {
|
| | | int gridIndex = i + 1;
|
| | | yunShiXBItems[i].transform.position = startItems[i].position;
|
| | | yunShiXBItems[i].SetActive(true);
|
| | | yunShiXBItems[i].Display(gridIndex);
|
| | | }
|
| | | qianTongRotationTween.Stop();
|
| | |
|
| | | for (int i = 0; i < qianPositionTweens.Count; i++)
|
| | | {
|
| | | qianPositionTweens[i].Stop();
|
| | | }
|
| | |
|
| | | transQianTong.transform.position = transStartQianTong.transform.position;
|
| | | transQianTong.transform.rotation = transStartQianTong.transform.rotation;
|
| | |
|
| | | for (int i = 0; i < transStartQian.Count; i++)
|
| | | {
|
| | | transQian[i].transform.position = transStartQian[i].transform.position;
|
| | | transQian[i].transform.rotation = transStartQian[i].transform.rotation;
|
| | | }
|
| | | }
|
| | |
|
| | | public void MoveAndDisappear()
|
| | | {
|
| | | WindowCenter.Instance.uiRoot.eventSystem.enabled = false;
|
| | | Sequence sequence = DOTween.Sequence();
|
| | | foreach (YunShiXBItem item in yunShiXBItems)
|
| | | {
|
| | | sequence.Join(item.transform.DOMove(transItemMissEnd.position, 0.2f).SetEase(Ease.InOutSine).OnComplete(() => { item.SetActive(false); }));
|
| | | }
|
| | | sequence.Join(transQianTong.transform.DORotate(new Vector3(0, 0, -5), 0.3f).SetEase(Ease.InOutSine).OnComplete(() => { qianTongUIEffect.Play(); }));
|
| | | sequence.Join(transQianTong.transform.DOMove(transQianTongMissEnd.position, 0.5f).SetEase(Ease.InOutSine));
|
| | | sequence.OnComplete(() => { ShakeQianTong(); });
|
| | | }
|
| | |
|
| | | private void ShowGetItem()
|
| | | {
|
| | | var xbItemlist = happyXBModel.rangelist;
|
| | | List<Item> itemList = new List<Item>();
|
| | |
|
| | | for (int i = 0; i < xbItemlist.Count; i++)
|
| | | {
|
| | | XBGetItem xbItem = xbItemlist[i];
|
| | | Item item = new Item();
|
| | | item.id = xbItem.itemId;
|
| | | item.count = xbItem.count;
|
| | | itemList.Add(item);
|
| | | }
|
| | | ItemLogicUtility.Instance.ShowGetItem(itemList, seconds: 0);
|
| | | Reset();
|
| | | WindowCenter.Instance.uiRoot.eventSystem.enabled = true;
|
| | | }
|
| | |
|
| | | public void ShakeQianTong()
|
| | | {
|
| | | qianTongRotationTween.Play();
|
| | |
|
| | | for (int i = 0; i < qianPositionTweens.Count; i++)
|
| | | {
|
| | | qianPositionTweens[i].duration = 0.3f;
|
| | | qianPositionTweens[i].Play();
|
| | | }
|
| | |
|
| | | var xbItemlist = happyXBModel.rangelist;
|
| | | if (xbItemlist.IsNullOrEmpty())
|
| | | {
|
| | | Reset();
|
| | | WindowCenter.Instance.uiRoot.eventSystem.enabled = true;
|
| | | return;
|
| | | }
|
| | | for (int i = 0; i < qianPositionTweens.Count; i++)
|
| | | {
|
| | | qianPositionTweens[i].duration = 0.3f;
|
| | | }
|
| | | Sequence moveSequence = DOTween.Sequence();
|
| | | moveSequence.AppendInterval(1.5f);
|
| | |
|
| | | if (xbItemlist.Count == 1)
|
| | | {
|
| | | YunShiXBItem item = yunShiXBItems[0];
|
| | | yunShiXBItems[0].transform.position = haveUIEffects[0].transform.position;
|
| | | Vector3 targetPosition = oneEnd.position;
|
| | | XBGetItem xbItem = happyXBModel.rangelist[0];
|
| | | DG.Tweening.Tween tween = item.transform.DOMove(targetPosition, 0.05f).SetDelay(0.05f).SetEase(Ease.InOutSine)
|
| | | .OnStart(() =>
|
| | | {
|
| | | haveUIEffects[0].Play();
|
| | | yunShiXBItems[0].Display(xbItem.itemId, xbItem.count);
|
| | | yunShiXBItems[0].SetActive(true);
|
| | | for (int i = 0; i < qianPositionTweens.Count; i++)
|
| | | {
|
| | | qianPositionTweens[i].duration = 0.1f;
|
| | | }
|
| | | });
|
| | | moveSequence.Append(tween);
|
| | | }
|
| | | else
|
| | | {
|
| | | for (int i = 0; i < yunShiXBItems.Count; i++)
|
| | | {
|
| | | if (i < xbItemlist.Count)
|
| | | {
|
| | | int index = i;
|
| | | YunShiXBItem item = yunShiXBItems[i];
|
| | | yunShiXBItems[i].transform.position = haveUIEffects[i].transform.position;
|
| | | Vector3 targetPosition = manyEnds[i].position;
|
| | | XBGetItem xbItem = happyXBModel.rangelist[i];
|
| | | DG.Tweening.Tween tween = item.transform.DOMove(targetPosition, 0.1f).SetDelay(0.1f).SetEase(Ease.InOutSine)
|
| | | .OnStart(() =>
|
| | | {
|
| | | haveUIEffects[index].Play();
|
| | | yunShiXBItems[index].Display(xbItem.itemId, xbItem.count);
|
| | | yunShiXBItems[index].SetActive(true);
|
| | | for (int i = 0; i < qianPositionTweens.Count; i++)
|
| | | {
|
| | | qianPositionTweens[i].duration = 0.1f;
|
| | | }
|
| | | });
|
| | | moveSequence.Append(tween);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | moveSequence.OnComplete(() =>
|
| | | {
|
| | | for (int i = 0; i < qianPositionTweens.Count; i++)
|
| | | {
|
| | | qianPositionTweens[i].duration = 0.3f;
|
| | | }
|
| | | Sequence sequence = DOTween.Sequence();
|
| | | sequence.Join(transQianTong.transform.DORotate(new Vector3(0, 0, 0), 0.2f).SetEase(Ease.InOutSine));
|
| | | sequence.Join(transQianTong.transform.DOMove(transStartQianTong.position, 0.2f).SetEase(Ease.InOutSine));
|
| | | sequence.OnComplete(() =>
|
| | | {
|
| | | qianTongRotationTween.Stop();
|
| | | for (int i = 0; i < qianPositionTweens.Count; i++)
|
| | | {
|
| | | qianPositionTweens[i].Stop();
|
| | | qianPositionTweens[i].SetStartState();
|
| | | }
|
| | | Clock.AlarmAfter(0.5, ShowGetItem);
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | private void RefreshSkipUI()
|
| | | {
|
| | | imgSkip.SetActive(model.isSkipXB);
|
| | | }
|
| | |
|
| | | private void HaveAllAward()
|
| | | {
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return;
|
| | |
|
| | | var award = TreasureCntAwardConfig.GetAwardIndexDict(type);
|
| | | if (award == null)
|
| | | return;
|
| | |
|
| | | var list = award.Keys.ToList();
|
| | | list.Sort();
|
| | | if (list == null)
|
| | | return;
|
| | | for (int i = 0; i < model.AwardCellCount; i++)
|
| | | {
|
| | | if (i < list.Count)
|
| | | {
|
| | | int id = award[list[i]];
|
| | | if (!TreasureCntAwardConfig.Has(id))
|
| | | continue;
|
| | | TreasureCntAwardConfig config = TreasureCntAwardConfig.Get(id);
|
| | | int state = model.GetAwardState(xbInfo.treasureCount, config.NeedTreasureCnt, xbInfo.treasureCntAward, config.AwardIndex);
|
| | | if (state == 1)
|
| | | {
|
| | | model.SendGetAward(type, config.NeedTreasureCnt);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void Display()
|
| | | {
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return;
|
| | |
|
| | | var award = TreasureCntAwardConfig.GetAwardIndexDict(type);
|
| | | if (award == null)
|
| | | return;
|
| | |
|
| | | var list = award.Keys.ToList();
|
| | | list.Sort();
|
| | | if (list == null)
|
| | | return;
|
| | |
|
| | | var funcSet = happyXBModel.GetXBFuncSet(type);
|
| | | if (funcSet == null)
|
| | | return;
|
| | | int toolCnt0 = packModel.GetItemCountByID(PackType.Item, funcSet.costToolIds[0]);
|
| | | int toolCnt1 = packModel.GetItemCountByID(PackType.Item, funcSet.costToolIds[1]);
|
| | | txtXBOneCount.text = StringUtility.Contact(toolCnt0, "/", funcSet.xbNums[0]);
|
| | | txtXBManyCount.text = StringUtility.Contact(toolCnt1, "/", funcSet.xbNums[1]);
|
| | | txtXBOne.text = Language.Get("HappyXB101", funcSet.xbNums[0]);
|
| | | txtXBMany.text = Language.Get("HappyXB101", funcSet.xbNums[1]);
|
| | | RefreshSkipUI();
|
| | | txtHasCnt.text = xbInfo.treasureCount.ToString();
|
| | | for (int i = 0; i < model.AwardCellCount; i++)
|
| | | {
|
| | | if (i < list.Count)
|
| | | {
|
| | | int id = award[list[i]];
|
| | | if (!TreasureCntAwardConfig.Has(id))
|
| | | continue;
|
| | | TreasureCntAwardConfig config = TreasureCntAwardConfig.Get(id);
|
| | | int state = model.GetAwardState(xbInfo.treasureCount, config.NeedTreasureCnt, xbInfo.treasureCntAward, config.AwardIndex);
|
| | | int[][] awardItemArr = config.AwardItemList;
|
| | | int itemID = awardItemArr[0][0];
|
| | | int itemCount = awardItemArr[0][1];
|
| | | ItemCellModel cellModel = new ItemCellModel(itemID, false, (ulong)itemCount);
|
| | | itemCells[i].Init(cellModel);
|
| | | itemCells[i].SetActive(true);
|
| | | itemCells[i].button.SetListener(() =>
|
| | | {
|
| | | if (state == 1)
|
| | | {
|
| | | HaveAllAward();
|
| | | }
|
| | | else
|
| | | {
|
| | | ItemTipUtility.Show(itemID);
|
| | | }
|
| | | });
|
| | |
|
| | | imgGreys[i].SetActive(state == 2);
|
| | | imgHaves[i].SetActive(state == 2);
|
| | |
|
| | | needCnts[i].SetActive(true);
|
| | | needCnts[i].text = config.NeedTreasureCnt.ToString();
|
| | |
|
| | | if (state != 0)
|
| | | {
|
| | | sliders[i].value = 1;
|
| | | }
|
| | | else
|
| | | {
|
| | | if (i == 0)
|
| | | {
|
| | | float value = Mathf.Floor((xbInfo.treasureCount / (float)config.NeedTreasureCnt) * 1000f) / 1000f;
|
| | | sliders[i].value = value;
|
| | | }
|
| | | else
|
| | | {
|
| | | int lastId = award[list[i - 1]];
|
| | | if (!TreasureCntAwardConfig.Has(lastId))
|
| | | continue;
|
| | | TreasureCntAwardConfig lastIdConfig = TreasureCntAwardConfig.Get(lastId);
|
| | | float value = Mathf.Floor(((xbInfo.treasureCount - lastIdConfig.NeedTreasureCnt) / (float)(config.NeedTreasureCnt - lastIdConfig.NeedTreasureCnt)) * 1000f) / 1000f;
|
| | | sliders[i].value = Mathf.Min(value, 1);
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | itemCells[i].SetActive(false);
|
| | | needCnts[i].SetActive(false);
|
| | | sliders[i].SetActive(false);
|
| | | imgGreys[i].SetActive(false);
|
| | | imgHaves[i].SetActive(false);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9ab12f626cda3d6418ac90fe26a8e843 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class YunShiXBItem : MonoBehaviour
|
| | | {
|
| | | [SerializeField] ImageEx imgBg;
|
| | | [SerializeField] ImageEx imgItem;
|
| | | [SerializeField] TextEx txtCount;
|
| | | [SerializeField] TextEx txtLimitCount;
|
| | | [SerializeField] Slider slider;
|
| | | [SerializeField] TextEx txtExpCount;
|
| | | [SerializeField] ButtonEx btnItem;
|
| | | HappyXBModel happyXBModel { get { return ModelCenter.Instance.GetModelEx<HappyXBModel>(); } }
|
| | | YunShiXBActModel model { get { return ModelCenter.Instance.GetModelEx<YunShiXBActModel>(); } }
|
| | |
|
| | | public void Display(int gridIndex)
|
| | | {
|
| | | OperationYunShi act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiXBActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return;
|
| | |
|
| | | int type = act.treasureType;
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return;
|
| | |
|
| | | XBGetItemConfig xbGetItemConfig = happyXBModel.GetXBItemConfigByType(type);
|
| | | if (xbGetItemConfig == null)
|
| | | return;
|
| | |
|
| | | int[][] GridItemRateList = xbGetItemConfig.GridItemRateList1;
|
| | | if (GridItemRateList.IsNullOrEmpty())
|
| | | return;
|
| | |
|
| | | Dictionary<int, int> rateDict = ConfigParse.GetRateDict(GridItemRateList);
|
| | | if (rateDict.IsNullOrEmpty())
|
| | | return;
|
| | |
|
| | | var dict = happyXBModel.GetXBGetItemByID(type);
|
| | | if (!dict.TryGetValue(gridIndex, out var info))
|
| | | return;
|
| | |
|
| | | if (!ItemConfig.Has(info.itemId))
|
| | | return;
|
| | |
|
| | | if (!TreasureSetConfig.Has(type))
|
| | | return;
|
| | | TreasureSetConfig treasureSetConfig = TreasureSetConfig.Get(type);
|
| | |
|
| | | ItemConfig itemConfig = ItemConfig.Get(info.itemId);
|
| | | imgItem.SetSprite(itemConfig.IconKey);
|
| | | txtCount.text = info.count.ToString();
|
| | |
|
| | | //如果不配置功能配置表,默认限量的配红,其它普通的配蓝
|
| | | //如果功能配置表有这个格子的配置,优先功能配置表的配置
|
| | | bool isLimit = TryGetLimitCount(xbInfo, gridIndex, out int limitCount);
|
| | | bool isLuckyGridNum = IsLuckyGridNum(type, gridIndex);
|
| | |
|
| | | if (model.TryGetItemBG(type, gridIndex, isLimit, out string str))
|
| | | {
|
| | | imgBg.SetSprite(str);
|
| | | }
|
| | |
|
| | | var xbLimitMaxCountDict = model.GetXbLimitMaxCountDict(treasureSetConfig.GridNumMaxLimitInfo);
|
| | |
|
| | | txtLimitCount.SetActive(isLimit);
|
| | | if (isLimit && xbLimitMaxCountDict.TryGetValue(gridIndex, out int limitMaxCount))
|
| | | {
|
| | | txtLimitCount.text = Language.Get("YunShi05", StringUtility.Contact(limitCount, "/", limitMaxCount));
|
| | | }
|
| | |
|
| | | slider.SetActive(isLimit && isLuckyGridNum);
|
| | | if (isLimit && isLuckyGridNum)
|
| | | {
|
| | | txtExpCount.text = StringUtility.Contact(xbInfo.luckValue, "/", treasureSetConfig.FullLucky);
|
| | | slider.value = Mathf.Floor((xbInfo.luckValue / (float)treasureSetConfig.FullLucky) * 1000f) / 1000f;
|
| | | }
|
| | |
|
| | | btnItem.SetListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(info.itemId);
|
| | | });
|
| | | }
|
| | |
|
| | | public void Display(int itemId, int count)
|
| | | {
|
| | | OperationYunShi act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiXBActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return;
|
| | |
|
| | | int type = act.treasureType;
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return;
|
| | |
|
| | | TreasureSetConfig treasureSetConfig = TreasureSetConfig.Get(type);
|
| | | if (!ItemConfig.Has(itemId))
|
| | | return;
|
| | |
|
| | | var dict = happyXBModel.GetXBGetItemByID(type);
|
| | | bool isHaveGridIndex = TryGetGridIndexByItemId(itemId, out int gridIndex);
|
| | | bool isLimit = TryGetLimitCount(xbInfo, gridIndex, out int limitCount);
|
| | | if (model.TryGetItemBG(type, gridIndex, isLimit, out string str))
|
| | | {
|
| | | imgBg.SetSprite(str);
|
| | | }
|
| | |
|
| | | ItemConfig itemConfig = ItemConfig.Get(itemId);
|
| | | imgItem.SetSprite(itemConfig.IconKey);
|
| | | txtCount.text = count.ToString();
|
| | | txtLimitCount.SetActive(false);
|
| | | slider.SetActive(false);
|
| | |
|
| | | btnItem.SetListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(itemId);
|
| | | });
|
| | | }
|
| | |
|
| | | public bool IsLuckyGridNum(int type, int gridIndex)
|
| | | {
|
| | | if (!TreasureSetConfig.Has(type))
|
| | | return false;
|
| | | int luckyGridNum = TreasureSetConfig.Get(type).LuckyGridNum;
|
| | | return luckyGridNum == gridIndex;
|
| | | }
|
| | |
|
| | | // 是限量有限制抽取次数的格子?
|
| | | public bool TryGetLimitCount(XBTypeInfo xBTypeInfo, int gridIndex, out int limitCount)
|
| | | {
|
| | | limitCount = 0;
|
| | | if (xBTypeInfo == null || xBTypeInfo.gridLimitCntDict == null)
|
| | | return false;
|
| | | if (xBTypeInfo.gridLimitCntDict.TryGetValue(gridIndex, out int count))
|
| | | {
|
| | | limitCount = count;
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | private bool TryGetGridIndexByItemId(int nowItemId, out int gridIndex)
|
| | | {
|
| | | gridIndex = 0;
|
| | | OperationYunShi act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiXBActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return false;
|
| | |
|
| | | int type = act.treasureType;
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return false;
|
| | |
|
| | | var dict = happyXBModel.GetXBGetItemByID(type);
|
| | | var list = dict.Keys.ToList();
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | int key = list[i];
|
| | | XBGetItem xBGetItem = dict[key];
|
| | | if (xBGetItem.itemId == nowItemId)
|
| | | {
|
| | | gridIndex = xBGetItem.gridIndex;
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c6e8e3b05dd2565498ddb66f1be04a49 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | |
|
| | | namespace vnxbqy.UI
|
| | | {
|
| | | public class YunShiXBProbabilityCell : CellView
|
| | | {
|
| | | [SerializeField] TextEx txtName;
|
| | | [SerializeField] TextEx txtRate;
|
| | |
|
| | | public void Display(int index, CellView cell)
|
| | | {
|
| | | int itemId = cell.info.Value.infoInt1;
|
| | | int count = cell.info.Value.infoInt2;
|
| | | int rate = cell.info.Value.infoInt3;
|
| | | if (!ItemConfig.Has(itemId))
|
| | | return;
|
| | | ItemConfig itemConfig = ItemConfig.Get(itemId);
|
| | |
|
| | | txtName.text = StringUtility.Contact(itemConfig.ItemName, " ", Language.Get("CelestialPalace13", count));
|
| | | double partRate = (double)rate / 100;
|
| | | txtRate.text = StringUtility.Contact(partRate.ToString("F2"), "%");
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f4dcc0bddf13e414d9d2d5921e8cd162 |
| | | 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 YunShiXBProbabilityWin : Window
|
| | | {
|
| | | [SerializeField] ScrollerController scroller;
|
| | | [SerializeField] ButtonEx btnClose;
|
| | | HappyXBModel happyXBModel { get { return ModelCenter.Instance.GetModelEx<HappyXBModel>(); } }
|
| | |
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | btnClose.SetListener(CloseClick);
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | scroller.OnRefreshCell += OnRefreshCell;
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | scroller.OnRefreshCell -= OnRefreshCell;
|
| | | }
|
| | |
|
| | | private void OnRefreshCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | var _cell = cell as YunShiXBProbabilityCell;
|
| | | _cell.Display(_cell.index, cell);
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | OperationYunShi act;
|
| | | OperationTimeHepler.Instance.TryGetOperation(YunShiXBActModel.operaType, out act);
|
| | | if (act == null)
|
| | | return;
|
| | |
|
| | | int type = act.treasureType;
|
| | | var xbInfo = happyXBModel.GetXBInfoByType(type);
|
| | | if (xbInfo == null)
|
| | | return;
|
| | |
|
| | | XBGetItemConfig xbGetItemConfig = happyXBModel.GetXBItemConfigByType(type);
|
| | | if (xbGetItemConfig == null)
|
| | | return;
|
| | |
|
| | | int[][] GridItemRateList = xbGetItemConfig.GridItemRateList1;
|
| | | if (GridItemRateList.IsNullOrEmpty())
|
| | | return;
|
| | |
|
| | | Dictionary<int, int> rateDict = ConfigParse.GetRateDict(GridItemRateList);
|
| | | if (rateDict.IsNullOrEmpty())
|
| | | return;
|
| | |
|
| | | var dict = happyXBModel.GetXBGetItemByID(type);
|
| | | var list = dict.Keys.ToList();
|
| | | List<CellInfo> cellInfos = new List<CellInfo>();
|
| | | list.Sort();
|
| | | if (!list.IsNullOrEmpty())
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | int girdIndex = list[i];
|
| | | var info = dict[girdIndex];
|
| | | int rate;
|
| | | if (!rateDict.TryGetValue(girdIndex, out rate))
|
| | | continue;
|
| | |
|
| | | CellInfo cellInfo = new CellInfo();
|
| | | cellInfo.infoInt1 = info.itemId;
|
| | | cellInfo.infoInt2 = info.count;
|
| | | cellInfo.infoInt3 = rate;
|
| | | cellInfos.Add(cellInfo);
|
| | | }
|
| | | }
|
| | | cellInfos.Sort(Cmp);
|
| | |
|
| | | scroller.Refresh();
|
| | | for (int i = 0; i < cellInfos.Count; i++)
|
| | | {
|
| | | CellInfo info = cellInfos[i];
|
| | | scroller.AddCell(ScrollerDataType.Header, i, info);
|
| | | }
|
| | | scroller.Restart();
|
| | | }
|
| | |
|
| | | private int Cmp(CellInfo x, CellInfo y)
|
| | | {
|
| | | // 首先比较 rate
|
| | | if (x.infoInt3 != y.infoInt3)
|
| | | {
|
| | | return x.infoInt3.CompareTo(y.infoInt3);
|
| | | }
|
| | |
|
| | | // 如果 rate 相同,则比较数量 (假设数量存储在 infoInt2 中)
|
| | | return x.infoInt2.CompareTo(y.infoInt2);
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | }
|
| | | }
|
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 181594e1df8146a499b2a1ac22207a63 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | |
|
| | | [SerializeField] Button m_XY;
|
| | | [SerializeField] Button m_LHD;
|
| | | [SerializeField] Button m_YS;
|
| | |
|
| | | private bool isNeedTip = true;
|
| | |
|
| | |
| | | m_xg.SetListener(() => { ModelCenter.Instance.GetModel<CelestialPalaceModel>().OpenCelestialPalaceWin(); });
|
| | | m_XY.SetListener(() => { WindowCenter.Instance.Open<FairyAffinityWin>(); });
|
| | | m_LHD.SetListener(() => { WindowCenter.Instance.Open<CycleHallWin>(); });
|
| | | m_YS.SetListener(() => { WindowCenter.Instance.Open<YunShiWin>(); });
|
| | | }
|
| | |
|
| | | public void Init()
|
| | |
| | | m_JPBN.SetActive(NeedForWhiteModel.Instance.IsOpen());
|
| | | m_XY.SetActive(ModelCenter.Instance.GetModel<FairyAffinityLoginActModel>().IsOpen);
|
| | | m_LHD.SetActive(ModelCenter.Instance.GetModel<CycleHallActModel>().IsOpen && !ModelCenter.Instance.GetModel<CycleHallActModel>().GetTabIDList().IsNullOrEmpty());
|
| | | m_YS.SetActive(ModelCenter.Instance.GetModel<YunShiXBActModel>().IsOpen);
|
| | | ShowNewActionButton();
|
| | | }
|
| | |
|
| | |
| | | public const int FairyAffinityRepoint = 461; //仙缘
|
| | | public const int FairyEmbleManageRepoint = 462;//仙盟徽章管理入口红点
|
| | | public const int CycleHallRepoint = 463; //轮回殿
|
| | | public const int YunShiRepoint = 464; //运势
|
| | | public const int RedPoint_MR648 = 900; // BT功能红点 - 每日648
|
| | |
|
| | |
|
| | |
| | | } |
| | | return textBuilder.ToString(); |
| | | } |
| | | |
| | | public string ToDisplayTimeEx()
|
| | | {
|
| | | var textBuilder = OperationTimeHepler.textBuilder;
|
| | | textBuilder.Length = 0;
|
| | | textBuilder.Append(startDate.ToDisplay(false));
|
| | | textBuilder.Append(string.Format(" {0}:{1}", joinStartHour.ToString("D2"), joinStartMinute.ToString("D2")));
|
| | | if (startDate != endDate)
|
| | | {
|
| | | textBuilder.Append(" - ");
|
| | | textBuilder.Append(endDate.ToDisplay(false));
|
| | | textBuilder.Append(string.Format(" {0}:{1}", joinEndHour.ToString("D2"), joinEndMinute.ToString("D2")));
|
| | | }
|
| | | return textBuilder.ToString();
|
| | | } |
| | | public override void Reset() |
| | | { |
| | | base.Reset(); |
| | |
| | | }
|
| | | }
|
| | | }
|
| | | public void UpdateActYunShiInfo(HAA87_tagMCActYunshiInfo package)
|
| | | {
|
| | | |
| | | Operation operationType = Operation.default48;
|
| | |
|
| | | switch (package.ActNum)
|
| | | {
|
| | | case 10:
|
| | | operationType = Operation.default48;
|
| | | break;
|
| | | }
|
| | | OperationBase operationBase = null;
|
| | | operationDict.TryGetValue(operationType, out operationBase);
|
| | | if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
|
| | | {
|
| | | ForceStopOperation(operationType);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (operationBase == null)
|
| | | {
|
| | | operationBase = new OperationYunShi();
|
| | | operationDict.Add(operationType, operationBase);
|
| | | }
|
| | | OperationYunShi operation = operationBase as OperationYunShi;
|
| | | operation.Reset();
|
| | | operation.startDate = ParseOperationDate(package.StartDate);
|
| | | operation.endDate = ParseOperationDate(package.EndtDate);
|
| | | operation.resetType = package.ResetType;
|
| | | operation.limitLv = package.LimitLV;
|
| | | operation.treasureType = package.TreasureType;
|
| | | if (operationTimeUpdateEvent != null)
|
| | | {
|
| | | operationTimeUpdateEvent(operationType);
|
| | | }
|
| | | }
|
| | | }
|
| | | public void UpdateActGubaoInfo(HAA81_tagMCActGubaoInfo package)
|
| | | {
|
| | | OperationBase operationBase = null;
|
| | |
| | | case 11:
|
| | | opreationType = Operation.default45;
|
| | | break;
|
| | | case 12:
|
| | | opreationType = Operation.default49;
|
| | | break;
|
| | | case 30:
|
| | | opreationType = Operation.default30;
|
| | | break;
|
| | |
| | | break;
|
| | | case 11:
|
| | | operationType = Operation.default46;
|
| | | break;
|
| | | case 12:
|
| | | operationType = Operation.default50;
|
| | | break;
|
| | | default:
|
| | | return;
|
| | |
| | | default45, //日期型活动 - 仙缘任务
|
| | | default46, //日期型活动 - 仙缘礼包
|
| | | default47, //日期型活动 - 轮回殿
|
| | | default48, |
| | | default49, |
| | | default50, |
| | | default48, //日期型活动 - 运势寻宝
|
| | | default49, //日期型活动 - 运势任务
|
| | | default50, //日期型活动 - 运势礼包
|
| | | max,
|
| | | }
|
| | | }
|
| | |
| | | RegisterModel<FairyAffinityMissionActModel>();
|
| | | RegisterModel<FairyAffinityRechargeGiftActModel>();
|
| | | RegisterModel<CycleHallActModel>();
|
| | | RegisterModel<YunShiXBActModel>();
|
| | | RegisterModel<YunShiMissionActModel>();
|
| | | RegisterModel<YunShiRechargeGiftActModel>();
|
| | | inited = true;
|
| | | }
|
| | |
|
| | |
| | | normalTasks.Add(new ConfigInitTask("ChatBubbleBoxStar", () => { ChatBubbleBoxStarConfig.Init(); }, () => { return ChatBubbleBoxStarConfig.inited; }));
|
| | | normalTasks.Add(new ConfigInitTask("EmojiPack", () => { EmojiPackConfig.Init(); }, () => { return EmojiPackConfig.inited; }));
|
| | | normalTasks.Add(new ConfigInitTask("CycleHall", () => { CycleHallConfig.Init(); }, () => { return CycleHallConfig.inited; }));
|
| | | normalTasks.Add(new ConfigInitTask("TreasureCntAward", () => { TreasureCntAwardConfig.Init(); }, () => { return TreasureCntAwardConfig.inited; }));
|
| | | }
|
| | |
|
| | | static List<ConfigInitTask> doingTasks = new List<ConfigInitTask>();
|
| | |
| | | FairyAffinityMissionAct = 215, //仙缘任务活动
|
| | | FairyAffinityRechargeGiftAct = 216, //仙缘礼包活动
|
| | | CycleHallAct = 217, //轮回殿活动
|
| | |
|
| | | YunShiXBAct = 218, //运势寻宝活动
|
| | | YunShiMissionAct = 219, //运势任务活动
|
| | | YunShiRechargeGiftAct = 220, //运势礼包活动
|
| | | }
|
| | |
|
| | | //仙玉购买的二次确认框类型
|