Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
| | |
| | | return null; |
| | | } |
| | | |
| | | //获得成就条件,默认一个类型只有一种条件 |
| | | //获得成就条件,只适用于只有1种条件的情况获取 |
| | | public static string GetConditionString(int type) |
| | | { |
| | | if (typeToIDsDict.ContainsKey(type)) |
| | |
| | | UpdateRedpoint(types); |
| | | } |
| | | |
| | | public int GetAchievementProgress(int type) |
| | | public int GetAchievementProgress(int type, string condKey = "") |
| | | { |
| | | if (achivementDict.ContainsKey(type)) |
| | | { |
| | | var condKey = SuccessConfig.GetConditionString(type); |
| | | if (string.IsNullOrEmpty(condKey)) |
| | | { |
| | | condKey = SuccessConfig.GetConditionString(type); |
| | | } |
| | | if (achivementDict[type].ContainsKey(condKey)) |
| | | { |
| | | return achivementDict[type][condKey]; |
| | |
| | | } |
| | | |
| | | //获取成就状态 0: 未领取 1: 未达成 2: 已领取 |
| | | public int GetAchievementState(int id) |
| | | public int GetAchievementState(int id, string condKey = "") |
| | | { |
| | | var config = SuccessConfig.Get(id); |
| | | var process = GetAchievementProgress(config.Type); |
| | | var process = GetAchievementProgress(config.Type, condKey); |
| | | if (process < config.NeedCnt) |
| | | { |
| | | return 1; |
| | |
| | | |
| | | //主线章节 |
| | | Redpoint mainLevelRedpoint = new Redpoint(MainRedDot.RedPoint_DailyKey, MainRedDot.RedPoint_MainMissionKey); |
| | | //庆典成就 |
| | | const int osGalaRepointSuccessID = MainRedDot.RedPoint_OSGala * 10 + 1; |
| | | Redpoint osGalaRedpoint = new Redpoint(MainRedDot.RedPoint_OSGala, osGalaRepointSuccessID); |
| | | |
| | | //类型:红点id |
| | | Dictionary<int, int> redpointDict = new Dictionary<int, int>() |
| | | { |
| | | {1, MainRedDot.RedPoint_MainMissionKey} |
| | | {1, MainRedDot.RedPoint_MainMissionKey}, |
| | | {2, osGalaRepointSuccessID}, |
| | | {3, osGalaRepointSuccessID}, |
| | | {4, osGalaRepointSuccessID}, |
| | | {5, osGalaRepointSuccessID}, |
| | | {6, osGalaRepointSuccessID}, |
| | | {7, osGalaRepointSuccessID}, |
| | | {8, osGalaRepointSuccessID}, |
| | | {9, osGalaRepointSuccessID}, |
| | | {10, osGalaRepointSuccessID}, |
| | | {11, osGalaRepointSuccessID}, |
| | | {12, osGalaRepointSuccessID}, |
| | | {13, osGalaRepointSuccessID}, |
| | | {14, osGalaRepointSuccessID}, |
| | | {15, osGalaRepointSuccessID}, |
| | | {16, osGalaRepointSuccessID}, |
| | | {17, osGalaRepointSuccessID}, |
| | | {18, osGalaRepointSuccessID}, |
| | | {19, osGalaRepointSuccessID}, |
| | | |
| | | }; |
| | | |
| | | void UpdateRedpoint(List<int> _types) |
| | |
| | | _types = redpointDict.Keys.ToList(); |
| | | } |
| | | |
| | | bool isGalaRed = false; |
| | | |
| | | foreach (var type in _types) |
| | | { |
| | | if (!redpointDict.ContainsKey(type)) |
| | | { |
| | | continue; |
| | | } |
| | | if (isGalaRed && type >= 2 && type <= 19) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | foreach (var id in allAchivement) |
| | | { |
| | | var config = SuccessConfig.Get(id); |
| | | if (type == 6) |
| | | { |
| | | process = GetAchievementProgress(type, config.Condition[0].ToString()); |
| | | } |
| | | if (config.NeedCnt <= process) |
| | | { |
| | | if (!IsAchievementAwarded(id)) |
| | | { |
| | | redpoint.state = RedPointState.Simple; |
| | | if (type >= 2 && type <= 19) |
| | | { |
| | | isGalaRed = true; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | |
| | | return true; |
| | | } |
| | | } |
| | | else if (type >= 2 && type <= 19) |
| | | { |
| | | return OSActivityManager.Instance.IsOpenedOSGala(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | |
| | | |
| | | int CmpIds(int a, int b) |
| | | { |
| | | var stateA = GetAchievementState(a); |
| | | var stateB = GetAchievementState(b); |
| | | var configA = SuccessConfig.Get(a); |
| | | var configB = SuccessConfig.Get(b); |
| | | |
| | | var condA = configA.Condition.IsNullOrEmpty() ? "" : configA.Condition[0].ToString(); |
| | | var condB = configB.Condition.IsNullOrEmpty() ? "" : configB.Condition[0].ToString(); |
| | | |
| | | var stateA = GetAchievementState(a, condA); |
| | | var stateB = GetAchievementState(b, condB); |
| | | |
| | | if (stateA != stateB) |
| | | { |
| | |
| | | return a - b; |
| | | } |
| | | |
| | | public List<int> GetAchievementIDsByTypes(int[] types) |
| | | { |
| | | List<int> allIds = new List<int>(); |
| | | foreach (var type in types) |
| | | { |
| | | var ids = SuccessConfig.GetTypeToIDDict(type); |
| | | if (!ids.IsNullOrEmpty()) |
| | | { |
| | | //合并 |
| | | allIds.AddRange(SuccessConfig.GetTypeToIDDict(type)); |
| | | } |
| | | // else |
| | | // { |
| | | // Debug.LogError($"{type}"); |
| | | // } |
| | | } |
| | | allIds.Sort(CmpIds); |
| | | return allIds; |
| | | } |
| | | |
| | | |
| | | public void SendGetAward(int id) |
| | | { |
| | | var config = SuccessConfig.Get(id); |
| | |
| | | |
| | | if (isToken.isOn) |
| | | { |
| | | // var loginModel = ModelCenter.Instance.GetModel<LoginModel>(); |
| | | // LoginManager.Instance.sdkLoginResult = new SDKUtils.FP_LoginOk() |
| | | // { |
| | | // account = account.text, |
| | | // token = password.text, |
| | | // tokenExpire = "1519750743000", |
| | | // phone = 0, |
| | | // accountID = 1000 |
| | | // }; |
| | | LoginManager.Instance.sdkLoginResult = new SDKUtils.FP_LoginOk() |
| | | { |
| | | account = account.text, |
| | | token = password.text, |
| | | tokenExpire = "1519750743000", |
| | | phone = 0, |
| | | accountID = 1000 |
| | | }; |
| | | |
| | | LoginManager.Instance.sdkLogined = true; |
| | | var ip = ServerListCenter.Instance.currentServer.region_domain; |
| | |
| | | [SerializeField] ItemCell itemCell; |
| | | [SerializeField] Transform transItemCellMask; |
| | | [SerializeField] ImageEx imgRed; |
| | | [SerializeField] Transform transOpenInfo; |
| | | [SerializeField] RichText txtOpenInfo; |
| | | [SerializeField] TextEx txtOpenInfo; |
| | | [SerializeField] Transform transMask; |
| | | public void Display(int index, CellView cell) |
| | | { |
| | |
| | | // 0-未解锁 1-可领取 2-已领取 |
| | | int state = FuncOpen.Instance.GetState(funcId); |
| | | imgRed.SetActive(state == 1); |
| | | transOpenInfo.SetActive(state == 0); |
| | | txtOpenInfo.SetActive(state == 0); |
| | | transMask.SetActive(state != 1); |
| | | transItemCellMask.SetActive(state == 2); |
| | | |
| | |
| | | [SerializeField] Button FirstChargeBtn; |
| | | [SerializeField] Button osMainLevelBtn; |
| | | [SerializeField] Button osHeroCallBtn; |
| | | [SerializeField] Button osGalaBtn; |
| | | |
| | | //坐骑 |
| | | [SerializeField] Image horseBGImg; |
| | |
| | | osHeroCallBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<OSHeroCallBaseWin>(); |
| | | }); |
| | | osGalaBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<OSGalaBaseWin>(); |
| | | }); |
| | | } |
| | | |
| | |
| | | { |
| | | DisplayHorse(); |
| | | } |
| | | else if (funcId == (int)FuncOpenEnum.OSMainLevl || funcId == (int)FuncOpenEnum.OSHeroCall) |
| | | else if (funcId == (int)FuncOpenEnum.OSMainLevl || funcId == (int)FuncOpenEnum.OSHeroCall |
| | | || funcId == (int)FuncOpenEnum.OSGala) |
| | | { |
| | | DisplayOSActivity(); |
| | | } |
| | |
| | | { |
| | | osMainLevelBtn.SetActive(OSActivityManager.Instance.IsOpened(3)); |
| | | osHeroCallBtn.SetActive(OSActivityManager.Instance.IsOpened(4)); |
| | | osGalaBtn.SetActive(OSActivityManager.Instance.IsOpenedOSGala()); |
| | | } |
| | | |
| | | void OnDayEvent() |
| | |
| | | osHeroCallGiftSortList.Add(_list[i] + 100000000);
|
| | | }
|
| | |
|
| | | config = FuncConfigConfig.Get("OSACelebration");
|
| | | osGalaOpenDays = int.Parse(config.Numerical1);
|
| | | osGalaScoreAwards = ConfigParse.ParseIntArray2Dict(config.Numerical2);
|
| | | ParseOSGalaConfig();
|
| | | }
|
| | |
|
| | | // 开服排行活动是否开启
|
| | |
| | | return a.CompareTo(b);
|
| | | }
|
| | |
|
| | | //开服招募榜礼包
|
| | | public void RefreshGiftSortList()
|
| | | {
|
| | | osHeroCallGiftSortList.Sort(CmpGift);
|
| | |
| | | {
|
| | | osMainLevelRedpoint.state = !DayRemind.Instance.GetDayRemind(DayRemind.OSMainLevel) ? RedPointState.Simple : RedPointState.None;
|
| | | osHeroCallRedpoint.state = RedPointState.None;
|
| | | osGalaRedpoint3.state = RedPointState.None;
|
| | |
|
| | | if (StoreModel.Instance.freeShopDict.Count == 0) return;
|
| | |
|
| | |
| | | if (StoreModel.Instance.GetShopLimitBuyCount(shopID) < config.LimitCnt)
|
| | | {
|
| | | osHeroCallRedpoint.state = RedPointState.Simple;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (StoreModel.Instance.freeShopDict.ContainsKey((int)StoreFunc.OSGalaGift))
|
| | | {
|
| | | var shopList = StoreModel.Instance.freeShopDict[(int)StoreFunc.OSGalaGift];
|
| | |
|
| | | for (int i = 0; i < shopList.Count; i++)
|
| | | {
|
| | | var shopID = shopList[i];
|
| | | var config = StoreConfig.Get(shopID);
|
| | | if (StoreModel.Instance.GetShopLimitBuyCount(shopID) < config.LimitCnt)
|
| | | {
|
| | | osGalaRedpoint3.state = RedPointState.Simple;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | #region 开服庆典
|
| | | //开服庆典
|
| | | public int osGalaOpenDays = 0; //持续天数
|
| | | public Dictionary<int, int[][]> osGalaScoreAwards = new Dictionary<int, int[][]>(); // 开服庆典积分奖励
|
| | | public Dictionary<int, int[][]> osGalaScoreAwards = new Dictionary<int, int[][]>(); // 开服庆典积分奖励 积分:奖励
|
| | | public Dictionary<int, int> typeToGuideID = new Dictionary<int, int>();
|
| | | public List<int> osGalaChangeSortList = new List<int>(); //兑换列表(商店5)
|
| | | public List<int> osGalaGiftSortList = new List<int>(); //开服庆典礼包 充值ID + 100000000
|
| | |
|
| | | public int osGalaScore = 0; //当前积分 累计的;消耗的是货币55
|
| | | public int osGalaAwardState = 0; //按位记录是否领取
|
| | | public event Action OnOSGalaDataChangeEvent;
|
| | |
|
| | | // 兑换商店
|
| | | // Redpoint osGalaRedpoint2 = new Redpoint(MainRedDot.RedPoint_OSGala, MainRedDot.RedPoint_OSGala * 10 + 2);
|
| | | // 礼包免费
|
| | | Redpoint osGalaRedpoint3 = new Redpoint(MainRedDot.RedPoint_OSGala, MainRedDot.RedPoint_OSGala * 10 + 3);
|
| | | // 总奖励
|
| | | Redpoint osGalaRedpoint4 = new Redpoint(MainRedDot.RedPoint_OSGala, MainRedDot.RedPoint_OSGala * 10 + 4);
|
| | |
|
| | |
|
| | | public void UpdateOSGalaData(HAB05_tagSCOSACelebrationInfo netPack)
|
| | | {
|
| | | osGalaScore = (int)netPack.PointTotal;
|
| | | osGalaAwardState = (int)netPack.PointAward;
|
| | | OnOSGalaDataChangeEvent?.Invoke();
|
| | | UpdateGalaRedpoint();
|
| | | }
|
| | |
|
| | | public bool IsOpenedOSGala()
|
| | |
| | | return TimeUtility.OpenDay <= osGalaOpenDays;
|
| | | }
|
| | |
|
| | | // 是否已领取奖励
|
| | | public bool IsGotAward(int index)
|
| | | {
|
| | | return (osGalaAwardState & (1 << index)) != 0;
|
| | | }
|
| | |
|
| | | // 是否可领取奖励
|
| | | public bool CanGetAward(int index, int score)
|
| | | {
|
| | | if (IsGotAward(index))
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (osGalaScore < score)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | void ParseOSGalaConfig()
|
| | | {
|
| | | var config = FuncConfigConfig.Get("OSACelebration");
|
| | | osGalaOpenDays = int.Parse(config.Numerical1);
|
| | | osGalaScoreAwards = ConfigParse.ParseIntArray2Dict(config.Numerical2);
|
| | |
|
| | | config = FuncConfigConfig.Get("Achievement");
|
| | | typeToGuideID = ConfigParse.ParseIntDict(config.Numerical1);
|
| | |
|
| | |
|
| | | var list = StoreModel.Instance.storeTypeDict[(int)StoreFunc.OSGalaChange];
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | var item = list[i];
|
| | | osGalaChangeSortList.Add(item.shopId);
|
| | | }
|
| | |
|
| | | var _list1 = StoreModel.Instance.storeTypeDict[(int)StoreFunc.OSGalaGift];
|
| | | var _list2 = RechargeManager.Instance.GetCTGIDListByType(19);
|
| | | for (int i = 0; i < _list1.Count; i++)
|
| | | {
|
| | | var item = _list1[i];
|
| | | osGalaGiftSortList.Add(item.shopId);
|
| | | }
|
| | | for (int i = 0; i < _list2.Count; i++)
|
| | | {
|
| | | osGalaGiftSortList.Add(_list2[i] + 100000000);
|
| | | }
|
| | | }
|
| | |
|
| | | public void RefreshOSGalaGiftSortList()
|
| | | {
|
| | | osGalaGiftSortList.Sort(CmpGift);
|
| | | }
|
| | |
|
| | | public void RefreshOSGalaChangeSortList()
|
| | | {
|
| | | osGalaGiftSortList.Sort(CmpGift);
|
| | | }
|
| | |
|
| | | void UpdateGalaRedpoint()
|
| | | {
|
| | | osGalaRedpoint4.state = RedPointState.None;
|
| | | var keys = osGalaScoreAwards.Keys.ToList();
|
| | | keys.Sort();
|
| | | for (int i = 0; i < keys.Count; i++)
|
| | | {
|
| | | var score = keys[i];
|
| | | if (CanGetAward(i, score))
|
| | | {
|
| | | osGalaRedpoint4.state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | #endregion
|
| | | }
|
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 玩个游戏 |
| | | // [ Date ]: Tuesday, July 24, 2018 |
| | | //-------------------------------------------------------- |
| | | |
| | | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | ////开服盛典 |
| | | public class OSGalaBaseWin : FunctionsBaseWin |
| | | { |
| | | [SerializeField] Image processImg; |
| | | [SerializeField] Text timeText; |
| | | [SerializeField] Text totalScoreText; |
| | | [SerializeField] ItemCell[] itemCells; |
| | | [SerializeField] Image[] gotImgs; |
| | | [SerializeField] Text[] scoreTexts; |
| | | [SerializeField] UIEffectPlayer[] effectPlayers; |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | base.OnPreOpen(); |
| | | OSActivityManager.Instance.OnOSGalaDataChangeEvent += OnOSGalaDataChangeEvent; |
| | | GlobalTimeEvent.Instance.secondEvent += ShowTime; |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | base.OnPreClose(); |
| | | OSActivityManager.Instance.OnOSGalaDataChangeEvent -= OnOSGalaDataChangeEvent; |
| | | GlobalTimeEvent.Instance.secondEvent -= ShowTime; |
| | | } |
| | | |
| | | |
| | | protected override void OpenSubUIByTabIndex() |
| | | { |
| | | switch (functionOrder) |
| | | { |
| | | case 0: |
| | | currentSubUI = UIManager.Instance.OpenWindow<OSGalaMissionWin>(); |
| | | break; |
| | | case 1: |
| | | currentSubUI = UIManager.Instance.OpenWindow<OSGalaChangeWin>(); |
| | | break; |
| | | case 2: |
| | | currentSubUI = UIManager.Instance.OpenWindow<OSGalaGiftWin>(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void OnOSGalaDataChangeEvent() |
| | | { |
| | | Display(); |
| | | } |
| | | |
| | | void Display() |
| | | { |
| | | var keys = OSActivityManager.Instance.osGalaScoreAwards.Keys.ToList(); |
| | | keys.Sort(); |
| | | // value 分段,按keys中的达标获取 |
| | | var addValue = 1.0f / keys.Count; |
| | | var value = 0f; |
| | | for (int i = 0; i < keys.Count; i++) |
| | | { |
| | | var score = keys[i]; |
| | | var award = OSActivityManager.Instance.osGalaScoreAwards[score]; |
| | | if (OSActivityManager.Instance.osGalaScore >= score) |
| | | { |
| | | value += addValue; |
| | | } |
| | | else |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | processImg.fillAmount = value; |
| | | ShowTime(); |
| | | totalScoreText.text = Language.Get("OSActivity11") + OSActivityManager.Instance.osGalaScore.ToString(); |
| | | |
| | | for (int i = 0; i < itemCells.Length; i++) |
| | | { |
| | | if (i < keys.Count) |
| | | { |
| | | itemCells[i].SetActive(true); |
| | | int score = keys[i]; |
| | | int index = i; |
| | | int itemID = OSActivityManager.Instance.osGalaScoreAwards[score][0][0]; |
| | | itemCells[i].Init(new ItemCellModel(itemID, false, OSActivityManager.Instance.osGalaScoreAwards[score][0][1])); |
| | | itemCells[i].button.AddListener(() => |
| | | { |
| | | if (!OSActivityManager.Instance.CanGetAward(index, score)) |
| | | { |
| | | ItemTipUtility.Show(itemID); |
| | | return; |
| | | } |
| | | |
| | | var pack = new CA504_tagCMPlayerGetReward(); |
| | | pack.RewardType = 9; |
| | | pack.DataEx = (uint)score; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | }); |
| | | |
| | | gotImgs[i].SetActive(OSActivityManager.Instance.IsGotAward(i)); |
| | | scoreTexts[i].text = keys[i].ToString(); |
| | | if (OSActivityManager.Instance.CanGetAward(index, score)) |
| | | { |
| | | effectPlayers[i].Play(); |
| | | } |
| | | else |
| | | { |
| | | effectPlayers[i].Stop(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | itemCells[i].SetActive(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void ShowTime() |
| | | { |
| | | if (TimeUtility.OpenDay >= OSActivityManager.Instance.osGalaOpenDays) |
| | | { |
| | | timeText.text = Language.Get("OSActivity6"); |
| | | } |
| | | else |
| | | { |
| | | timeText.text = Language.Get("OSActivity10") + TimeUtility.SecondsToShortDHMS(TimeUtility.GetRemindTimeByOpenDay(OSActivityManager.Instance.osGalaOpenDays)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 40d472c19a23cf7439b6b4171a3dc689 |
| | | 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; |
| | | |
| | | public class OSGalaChangeCell : CellView |
| | | { |
| | | [SerializeField] ItemCell moneyItem; |
| | | [SerializeField] ItemCell[] itemCells; |
| | | [SerializeField] Button buyBtn; |
| | | [SerializeField] Transform saleOutRect; |
| | | [SerializeField] Text buyLimitText; |
| | | |
| | | public void Display(int index) |
| | | { |
| | | var id = OSActivityManager.Instance.osGalaChangeSortList[index]; |
| | | //商店 |
| | | var storeConfig = StoreConfig.Get(id); |
| | | |
| | | int scoreItemID = UIHelper.GetItemIDWithMoneyType(55); |
| | | moneyItem.Init(new ItemCellModel(scoreItemID, false, storeConfig.MoneyNum)); |
| | | moneyItem.button.AddListener(() => |
| | | { |
| | | ItemTipUtility.Show(scoreItemID); |
| | | }); |
| | | |
| | | |
| | | var awards = StoreModel.Instance.GetShopItemlistEx(storeConfig); |
| | | for (int i = 0; i < itemCells.Length; i++) |
| | | { |
| | | var itemCell = itemCells[i]; |
| | | if (i < awards.Count) |
| | | { |
| | | itemCell.SetActive(true); |
| | | int itemID = awards[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, awards[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | | itemCell.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | var state = StoreModel.Instance.GetShopIDState(id); |
| | | if (state == 1) |
| | | { |
| | | saleOutRect.SetActive(true); |
| | | buyBtn.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | saleOutRect.SetActive(false); |
| | | buyBtn.SetActive(true); |
| | | buyBtn.SetListener(() => |
| | | { |
| | | StoreModel.Instance.SendBuyShopItem(storeConfig, 1); |
| | | }); |
| | | } |
| | | var buyCnt = StoreModel.Instance.GetShopLimitBuyCount(id); |
| | | buyLimitText.text = Language.Get("storename8", storeConfig.LimitCnt - buyCnt, storeConfig.LimitCnt); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 67af5ca397064d24387bb5dafc986b69 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 玩个游戏 |
| | | // [ Date ]: Tuesday, July 24, 2018 |
| | | //-------------------------------------------------------- |
| | | |
| | | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | ////开服庆典 - 兑换 |
| | | public class OSGalaChangeWin : UIBase |
| | | { |
| | | [SerializeField] ScrollerController scrollerController; |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | scrollerController.OnRefreshCell += OnRefreshCell; |
| | | StoreModel.Instance.RefreshBuyShopLimitEvent += RefreshStore; |
| | | OSActivityManager.Instance.RefreshOSGalaChangeSortList(); |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | scrollerController.OnRefreshCell -= OnRefreshCell; |
| | | StoreModel.Instance.RefreshBuyShopLimitEvent -= RefreshStore; |
| | | } |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as OSGalaChangeCell; |
| | | _cell.Display(cell.index); |
| | | } |
| | | |
| | | void Display() |
| | | { |
| | | scrollerController.Refresh(); |
| | | for (int i = 0; i < OSActivityManager.Instance.osGalaChangeSortList.Count; i++) |
| | | { |
| | | scrollerController.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | scrollerController.Restart(); |
| | | |
| | | } |
| | | |
| | | void RefreshStore() |
| | | { |
| | | scrollerController.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: da028c17d189bf4479d73388ae438c28 |
| | | 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; |
| | | |
| | | public class OSGalaGiftCell : CellView |
| | | { |
| | | [SerializeField] Text nameText; |
| | | [SerializeField] ItemCell[] itemCells; |
| | | [SerializeField] Button buyBtn; |
| | | [SerializeField] Text moneyText; |
| | | [SerializeField] Image moneyIcon; |
| | | [SerializeField] Transform saleOutRect; |
| | | [SerializeField] Image redImg; |
| | | [SerializeField] Text buyLimitText; |
| | | [SerializeField] Image maskImg; |
| | | |
| | | public void Display(int index) |
| | | { |
| | | var id = OSActivityManager.Instance.osGalaGiftSortList[index]; |
| | | if (id > 100000000) |
| | | { |
| | | //充值 |
| | | id -= 100000000; |
| | | var ctgConfig = CTGConfig.Get(id); |
| | | nameText.text = ctgConfig.Title; |
| | | for (int i = 0; i < itemCells.Length; i++) |
| | | { |
| | | var itemCell = itemCells[i]; |
| | | if (i < ctgConfig.GainItemList.Length) |
| | | { |
| | | itemCell.SetActive(true); |
| | | int itemID = ctgConfig.GainItemList[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, ctgConfig.GainItemList[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | | itemCell.SetActive(false); |
| | | } |
| | | } |
| | | RechargeManager.Instance.TryGetRechargeCount(id, out var rechargeCount); |
| | | var limitCnt = ctgConfig.DailyBuyCount; |
| | | if (rechargeCount.todayCount < limitCnt) |
| | | { |
| | | saleOutRect.SetActive(false); |
| | | maskImg.SetActive(false); |
| | | buyBtn.SetActive(true); |
| | | buyBtn.SetListener(() => |
| | | { |
| | | RechargeManager.Instance.CTG(id); |
| | | }); |
| | | |
| | | RechargeManager.Instance.TryGetOrderInfo(id, out var orderInfo); |
| | | |
| | | moneyText.text = Language.Get("PayMoneyNum", orderInfo.PayRMBNumOnSale); |
| | | moneyIcon.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | saleOutRect.SetActive(true); |
| | | maskImg.SetActive(true); |
| | | buyBtn.SetActive(false); |
| | | } |
| | | buyLimitText.text = Language.Get("storename6", limitCnt - rechargeCount.todayCount, limitCnt); |
| | | redImg.SetActive(false); |
| | | |
| | | } |
| | | else |
| | | { |
| | | //商店 |
| | | var storeConfig = StoreConfig.Get(id); |
| | | nameText.text = storeConfig.Name; |
| | | var awards = StoreModel.Instance.GetShopItemlistEx(storeConfig); |
| | | for (int i = 0; i < itemCells.Length; i++) |
| | | { |
| | | var itemCell = itemCells[i]; |
| | | if (i < awards.Count) |
| | | { |
| | | itemCell.SetActive(true); |
| | | int itemID = awards[i][0]; |
| | | itemCell.Init(new ItemCellModel(itemID, true, awards[i][1])); |
| | | itemCell.button.SetListener(() => ItemTipUtility.Show(itemID)); |
| | | } |
| | | else |
| | | { |
| | | itemCell.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | var state = StoreModel.Instance.GetShopIDState(id); |
| | | if (state == 1) |
| | | { |
| | | saleOutRect.SetActive(true); |
| | | maskImg.SetActive(true); |
| | | buyBtn.SetActive(false); |
| | | redImg.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | saleOutRect.SetActive(false); |
| | | maskImg.SetActive(false); |
| | | buyBtn.SetActive(true); |
| | | buyBtn.SetListener(() => |
| | | { |
| | | StoreModel.Instance.SendBuyShopItemWithPopCheck(storeConfig, 1); |
| | | }); |
| | | moneyText.text = storeConfig.MoneyNum == 0 ? Language.Get("L1127") : storeConfig.MoneyNum.ToString(); |
| | | moneyIcon.SetActive(storeConfig.MoneyNum != 0); |
| | | moneyIcon.SetIconWithMoneyType(storeConfig.MoneyType); |
| | | redImg.SetActive(storeConfig.MoneyNum == 0); |
| | | } |
| | | var buyCnt = StoreModel.Instance.GetShopLimitBuyCount(id); |
| | | buyLimitText.text = Language.Get("storename6", storeConfig.LimitCnt - buyCnt, storeConfig.LimitCnt); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d7390224540c1054c9ba0e96bae8674b |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 玩个游戏 |
| | | // [ Date ]: Tuesday, July 24, 2018 |
| | | //-------------------------------------------------------- |
| | | |
| | | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | ////开服庆典 - 礼包 |
| | | public class OSGalaGiftWin : UIBase |
| | | { |
| | | [SerializeField] ScrollerController scrollerController; |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | scrollerController.OnRefreshCell += OnRefreshCell; |
| | | StoreModel.Instance.RefreshBuyShopLimitEvent += RefreshStore; |
| | | RechargeManager.Instance.rechargeCountEvent += OnRechargeCountEvent; |
| | | OSActivityManager.Instance.RefreshOSGalaGiftSortList(); |
| | | Display(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | scrollerController.OnRefreshCell -= OnRefreshCell; |
| | | StoreModel.Instance.RefreshBuyShopLimitEvent -= RefreshStore; |
| | | RechargeManager.Instance.rechargeCountEvent -= OnRechargeCountEvent; |
| | | } |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as OSGalaGiftCell; |
| | | _cell.Display(cell.index); |
| | | } |
| | | |
| | | void Display() |
| | | { |
| | | scrollerController.Refresh(); |
| | | for (int i = 0; i < OSActivityManager.Instance.osGalaGiftSortList.Count; i++) |
| | | { |
| | | scrollerController.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | scrollerController.Restart(); |
| | | |
| | | } |
| | | |
| | | void RefreshStore() |
| | | { |
| | | scrollerController.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | |
| | | void OnRechargeCountEvent(int id) |
| | | { |
| | | scrollerController.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2ef7df34ebcd38d42ba1ca95b494ba7d |
| | | 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; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | public class OSGalaMissionCell : CellView |
| | | { |
| | | [SerializeField] Text nameText; |
| | | [SerializeField] Image processImg; |
| | | [SerializeField] Text processText; |
| | | [SerializeField] ItemCell[] itemCells; |
| | | |
| | | [SerializeField] Button getBtn; |
| | | [SerializeField] Button gotoBtn; |
| | | [SerializeField] Transform gotRect; |
| | | |
| | | |
| | | public void Display(int id) |
| | | { |
| | | var config = SuccessConfig.Get(id); |
| | | int targetValue = 0; |
| | | int curValue = 0; |
| | | var type = config.Type; |
| | | if (type == 2) |
| | | { |
| | | // 主线关卡活动 |
| | | nameText.text = Language.Get($"Achievement{type}", config.NeedCnt / 100, config.NeedCnt % 100); |
| | | |
| | | } |
| | | else if (type == 4) |
| | | { |
| | | nameText.text = Language.Get($"Achievement{type}", UIHelper.AppendColor(OfficialRankManager.Instance.GetOfficialRankColor(config.NeedCnt), |
| | | RealmConfig.Get(config.NeedCnt).Name)); |
| | | } |
| | | else if (type == 6) |
| | | { |
| | | // 装备品质 |
| | | nameText.text = Language.Get($"Achievement{type}", config.NeedCnt, UIHelper.GetQualityNameWithColor(config.Condition[0])); |
| | | } |
| | | else if (config.Condition.IsNullOrEmpty()) |
| | | { |
| | | nameText.text = Language.Get($"Achievement{type}", config.NeedCnt); |
| | | } |
| | | else |
| | | { |
| | | nameText.text = Language.Get($"Achievement{type}", config.NeedCnt, config.Condition[0]); |
| | | } |
| | | |
| | | if (type == 2) |
| | | { |
| | | targetValue = MainLevelConfig.GetToTargetLevelIndex(config.NeedCnt) + 1; |
| | | curValue = MainLevelConfig.GetToTargetLevelIndex(AchievementManager.Instance.GetAchievementProgress(type)) + 1; |
| | | } |
| | | else if (type == 6) |
| | | { |
| | | targetValue = config.NeedCnt; |
| | | curValue = AchievementManager.Instance.GetAchievementProgress(type, config.Condition[0].ToString()); |
| | | } |
| | | else |
| | | { |
| | | targetValue = config.NeedCnt; |
| | | curValue = AchievementManager.Instance.GetAchievementProgress(type); |
| | | } |
| | | |
| | | processImg.fillAmount = (float)curValue / targetValue; |
| | | processText.text = Math.Min(targetValue, curValue) + "/" + targetValue; |
| | | |
| | | var cond = config.Condition.IsNullOrEmpty() ? "" : config.Condition[0].ToString(); |
| | | var state = AchievementManager.Instance.GetAchievementState(id, cond); |
| | | for (int i = 0; i < itemCells.Length; i++) |
| | | { |
| | | if (i < config.AwardItemList.Length) |
| | | { |
| | | itemCells[i].SetActive(true); |
| | | int itemID = config.AwardItemList[i][0]; |
| | | itemCells[i].Init(new ItemCellModel(itemID, false, config.AwardItemList[i][1])); |
| | | itemCells[i].button.AddListener(() => |
| | | { |
| | | ItemTipUtility.Show(itemID); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | itemCells[i].SetActive(false); |
| | | } |
| | | } |
| | | |
| | | getBtn.SetActive(state == 0); |
| | | gotoBtn.SetActive(state == 1); |
| | | gotRect.SetActive(state == 2); |
| | | |
| | | |
| | | getBtn.AddListener(() => |
| | | { |
| | | AchievementManager.Instance.SendGetAward(id); |
| | | }); |
| | | |
| | | gotoBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.CloseWindow<OSGalaBaseWin>(); |
| | | |
| | | int guideID = 0; |
| | | OSActivityManager.Instance.typeToGuideID.TryGetValue(type, out guideID); |
| | | if (guideID > 0) |
| | | { |
| | | NewBieCenter.Instance.StartNewBieGuide(guideID); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3eca62a486d2d9a40bea2997c93082fe |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 玩个游戏 |
| | | // [ Date ]: Tuesday, July 24, 2018 |
| | | //-------------------------------------------------------- |
| | | |
| | | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | ////开服活动-主线关卡活动 |
| | | public class OSGalaMissionWin : UIBase |
| | | { |
| | | [SerializeField] ScrollerController scroller; |
| | | |
| | | int[] types = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; |
| | | |
| | | List<int> ids = new List<int>(); |
| | | protected override void OnPreOpen() |
| | | { |
| | | scroller.OnRefreshCell += OnRefreshCell; |
| | | AchievementManager.Instance.OnAchievementUpdateEvent += OnAchievementUpdateEvent; |
| | | CreateScroller(); |
| | | |
| | | |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | scroller.OnRefreshCell -= OnRefreshCell; |
| | | AchievementManager.Instance.OnAchievementUpdateEvent -= OnAchievementUpdateEvent; |
| | | |
| | | } |
| | | |
| | | void OnAchievementUpdateEvent(int type) |
| | | { |
| | | // -1 为所有类型 |
| | | if (type >= 2 && type <= 19 || type == -1) |
| | | { |
| | | ids = AchievementManager.Instance.GetAchievementIDsByTypes(types); |
| | | scroller.m_Scorller.RefreshActiveCellViews(); |
| | | } |
| | | } |
| | | |
| | | void CreateScroller() |
| | | { |
| | | ids = AchievementManager.Instance.GetAchievementIDsByTypes(types); |
| | | var count = ids.Count; |
| | | scroller.Refresh(); |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | scroller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | scroller.Restart(); |
| | | |
| | | } |
| | | |
| | | |
| | | void OnRefreshCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | var _cell = cell as OSGalaMissionCell; |
| | | _cell.Display(ids[cell.index]); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 030ec9a086c424f4d92911dac344b8ff |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public const int RedPoint_OSMainLevel = 111; //开服榜
|
| | | public const int RedPoint_OSHeroCard = 112;
|
| | | public const int RedPoint_OSGala = 113; //开服庆典
|
| | | Redpoint osGalaRedpoint = new Redpoint(RedPoint_OSGala);
|
| | |
|
| | | public const int RedPoint_Download = 116;
|
| | |
|
| | |
| | | Guild = 2, //2:公会
|
| | | Hero = 3, //3:将魂
|
| | | OSHeroCall = 4, //4:开服招募礼包
|
| | | OSGalaChange = 5, //5:开服庆典兑换
|
| | | OSGalaGift = 6, //6:开服庆典礼包
|
| | |
|
| | | }
|
| | |
|
| | |
| | | default44, // 272 武将招募积分 |
| | | GoldRush = 285, // 淘金令 |
| | | ChallengeVoucher = 286,//挑战凭证 |
| | | OSGalaScore = 288, //开服庆典积分 |
| | | }; |
| | | |
| | | |
| | |
| | | {43, PlayerDataType.default34}, |
| | | {42, PlayerDataType.default33}, |
| | | {53, PlayerDataType.ChallengeVoucher}, |
| | | {55, PlayerDataType.OSGalaScore}, |
| | | {99, PlayerDataType.ExAttr11}, |
| | | }; |
| | | |
| | |
| | | //挑战凭证 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.ChallengeVoucher); |
| | | } |
| | | case 55: |
| | | { |
| | | //开服庆典积分 |
| | | return PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.OSGalaScore); |
| | | } |
| | | case 98: |
| | | { |
| | | //过期型代金券 |