Ejemplo n.º 1
0
 public void SetSortValue(GameUtility.UnitSortModes mode, int value, bool isLevelActive = true)
 {
     if (!Object.op_Inequality((Object)this.SortBadge, (Object)null))
     {
         return;
     }
     if (mode != GameUtility.UnitSortModes.Level && mode != GameUtility.UnitSortModes.Rarity && mode != GameUtility.UnitSortModes.Time)
     {
         if (Object.op_Inequality((Object)this.SortBadge.Value, (Object)null))
         {
             this.SortBadge.Value.set_text(value.ToString());
         }
         if (Object.op_Inequality((Object)this.SortBadge.Icon, (Object)null))
         {
             this.SortBadge.Icon.set_sprite(GameSettings.Instance.GetUnitSortModeIcon(mode));
         }
         ((Component)this.SortBadge).get_gameObject().SetActive(true);
         this.mIsLvActive = isLevelActive;
     }
     else
     {
         ((Component)this.SortBadge).get_gameObject().SetActive(false);
         this.mIsLvActive = true;
     }
 }
Ejemplo n.º 2
0
        protected override void Start()
        {
            base.Start();
            if (Object.op_Equality((Object)this.ItemTemplate, (Object)null))
            {
                return;
            }
            this.mUnitSortMode = !PlayerPrefs.HasKey("UnitSortMode") ? GameUtility.UnitSortModes.Time : (GameUtility.UnitSortModes)PlayerPrefs.GetInt("UnitSortMode");
            if (Object.op_Inequality((Object)this.SortFilter, (Object)null))
            {
                GameSettings instance = GameSettings.Instance;
                for (int index = 0; index < instance.UnitSort_Modes.Length; ++index)
                {
                    this.SortFilter.AddItem(LocalizedText.Get("sys.SORT_" + instance.UnitSort_Modes[index].Mode.ToString().ToUpper()), index);
                }
                this.SortFilter.Selection = Math.Max(Array.FindIndex <GameUtility.UnitSortModes>(GameUtility.UnitSortMenuItems, (Predicate <GameUtility.UnitSortModes>)(p => p == this.mUnitSortMode)), 0);
                this.SortFilter.OnSelectionChangeDelegate = new Pulldown.SelectItemEvent(this.OnSortModeChange);
            }
            if (Object.op_Inequality((Object)this.UnitBadge, (Object)null))
            {
                bool flag = MonoSingleton <GameManager> .Instance.CheckBadges(GameManager.BadgeTypes.Unit);

                this.UnitBadge.SetActive(flag);
                this.mPrevUnitBadgeState = flag;
            }
            if (Object.op_Inequality((Object)this.UnitUnlockBadge, (Object)null))
            {
                bool flag = MonoSingleton <GameManager> .Instance.CheckBadges(GameManager.BadgeTypes.UnitUnlock);

                this.UnitUnlockBadge.SetActive(flag);
                this.mPrevUnlockBadgeState = flag;
            }
            this.RefreshData();
        }
Ejemplo n.º 3
0
 public void SetSortMethod(string method, bool ascending, string[] filters)
 {
     GameUtility.UnitSortModes unitSortModes = GameUtility.UnitSortModes.Time;
     try
     {
         if (!string.IsNullOrEmpty(method))
         {
             unitSortModes = (GameUtility.UnitSortModes)Enum.Parse(typeof(GameUtility.UnitSortModes), method, true);
         }
     }
     catch (Exception ex)
     {
         if (GameUtility.IsDebugBuild)
         {
             DebugUtility.LogError("Unknown sort mode: " + method);
         }
     }
     if (Object.op_Inequality((Object)this.AscendingIcon, (Object)null))
     {
         this.AscendingIcon.SetActive(ascending);
     }
     if (Object.op_Inequality((Object)this.DescendingIcon, (Object)null))
     {
         this.DescendingIcon.SetActive(!ascending);
     }
     if (unitSortModes == GameUtility.UnitSortModes.Time)
     {
         ascending = !ascending;
     }
     this.RefreshData();
 }
Ejemplo n.º 4
0
        public void LoadSelectType()
        {
            this.m_SelectType = UnitListSortWindow.SelectType.NONE;
            string key1 = "UNITLIST_SORT";

            if (!string.IsNullOrEmpty(key1))
            {
                if (PlayerPrefsUtility.HasKey(key1))
                {
                    string s      = PlayerPrefsUtility.GetString(key1, string.Empty);
                    int    result = 0;
                    if (!string.IsNullOrEmpty(s) && int.TryParse(s, out result))
                    {
                        this.m_SelectType = (UnitListSortWindow.SelectType)result;
                    }
                }
                else
                {
                    string key2 = "UNITLIST";
                    if (!string.IsNullOrEmpty(key2))
                    {
                        this.m_SelectType = UnitListSortWindow.SelectType.NONE;
                        if (PlayerPrefsUtility.HasKey(key2))
                        {
                            GameUtility.UnitSortModes oldMode = GameUtility.UnitSortModes.Time;
                            string str = PlayerPrefsUtility.GetString(key2, string.Empty);
                            try
                            {
                                if (!string.IsNullOrEmpty(str))
                                {
                                    oldMode = (GameUtility.UnitSortModes)Enum.Parse(typeof(GameUtility.UnitSortModes), str, true);
                                }
                            }
                            catch (Exception ex)
                            {
                                DebugUtility.LogError("Unknown sort mode:" + str);
                            }
                            this.SetSection(UnitListSortWindow.ConvertSortMode(oldMode));
                        }
                        if (PlayerPrefsUtility.HasKey(key2 + "#"))
                        {
                            this.SetAlignment(UnitListSortWindow.ConvertReverse(PlayerPrefsUtility.GetInt(key2 + "#", 0) != 0));
                        }
                        this.SaveSelectType();
                    }
                }
            }
            if (this.GetSection() == UnitListSortWindow.SelectType.NONE)
            {
                this.SetSection(UnitListSortWindow.SelectType.TIME);
            }
            if (this.GetAlignment() == UnitListSortWindow.SelectType.NONE)
            {
                this.SetAlignment(UnitListSortWindow.SelectType.SYOJYUN);
            }
            this.m_SelectTypeReg = this.m_SelectType;
        }
Ejemplo n.º 5
0
 public Sprite GetUnitSortModeIcon(GameUtility.UnitSortModes mode)
 {
     for (int index = 0; index < this.UnitSort_Modes.Length; ++index)
     {
         if (this.UnitSort_Modes[index].Mode == mode)
         {
             return(this.UnitSort_Modes[index].Icon);
         }
     }
     return((Sprite)null);
 }
Ejemplo n.º 6
0
        public static UnitListSortWindow.SelectType ConvertSortMode(GameUtility.UnitSortModes oldMode)
        {
            switch (oldMode)
            {
            case GameUtility.UnitSortModes.Time:
                return(UnitListSortWindow.SelectType.TIME);

            case GameUtility.UnitSortModes.Level:
                return(UnitListSortWindow.SelectType.LEVEL);

            case GameUtility.UnitSortModes.JobRank:
                return(UnitListSortWindow.SelectType.JOBRANK);

            case GameUtility.UnitSortModes.HP:
                return(UnitListSortWindow.SelectType.HP);

            case GameUtility.UnitSortModes.Atk:
                return(UnitListSortWindow.SelectType.ATK);

            case GameUtility.UnitSortModes.Def:
                return(UnitListSortWindow.SelectType.DEF);

            case GameUtility.UnitSortModes.Mag:
                return(UnitListSortWindow.SelectType.MAG);

            case GameUtility.UnitSortModes.Mnd:
                return(UnitListSortWindow.SelectType.MND);

            case GameUtility.UnitSortModes.Spd:
                return(UnitListSortWindow.SelectType.SPD);

            case GameUtility.UnitSortModes.Total:
                return(UnitListSortWindow.SelectType.TOTAL);

            case GameUtility.UnitSortModes.Awake:
                return(UnitListSortWindow.SelectType.AWAKE);

            case GameUtility.UnitSortModes.Combination:
                return(UnitListSortWindow.SelectType.COMBINATION);

            case GameUtility.UnitSortModes.Rarity:
                return(UnitListSortWindow.SelectType.RARITY);

            default:
                return(UnitListSortWindow.SelectType.NONE);
            }
        }
Ejemplo n.º 7
0
 public void SetSortMethod(string method, bool ascending, string[] filters)
 {
     GameUtility.UnitSortModes unitSortModes = GameUtility.UnitSortModes.Time;
     try
     {
         if (!string.IsNullOrEmpty(method))
         {
             unitSortModes = (GameUtility.UnitSortModes)Enum.Parse(typeof(GameUtility.UnitSortModes), method, true);
         }
     }
     catch (Exception ex)
     {
         if (GameUtility.IsDebugBuild)
         {
             DebugUtility.LogError("Unknown sort mode: " + method);
         }
     }
     if (Object.op_Inequality((Object)this.AscendingIcon, (Object)null))
     {
         this.AscendingIcon.SetActive(ascending);
     }
     if (Object.op_Inequality((Object)this.DescendingIcon, (Object)null))
     {
         this.DescendingIcon.SetActive(!ascending);
     }
     if (unitSortModes == GameUtility.UnitSortModes.Time)
     {
         ascending = !ascending;
     }
     if (Object.op_Inequality((Object)this.SortModeCaption, (Object)null))
     {
         this.SortModeCaption.set_text(LocalizedText.Get("sys.SORT_" + unitSortModes.ToString().ToUpper()));
     }
     this.mReverse      = ascending;
     this.mUnitSortMode = unitSortModes;
     this.mUnitFilter   = filters;
     this.RefreshData();
 }
Ejemplo n.º 8
0
 private void OnSortModeChange(int index)
 {
     this.mUnitSortMode = GameSettings.Instance.UnitSort_Modes[index].Mode;
     PlayerPrefs.SetInt("UnitSortMode", (int)this.mUnitSortMode);
     this.RefreshData();
 }