Inheritance: BaseTab
 public void Init()
 {
     foreach (KeyValuePair <int, Manager.Housing.AreaSizeInfo> keyValuePair in Singleton <Manager.Housing> .Instance.dicAreaSizeInfo)
     {
         GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.tabOriginal, this.tabRoot);
         gameObject.SetActive(true);
         SizeTab component = (SizeTab)gameObject.GetComponent <SizeTab>();
         int     type      = keyValuePair.Value.no;
         component.Text = string.Format("{0}X{1}X{2}", (object)((Vector3Int) ref keyValuePair.Value.limitSize).get_x(), (object)((Vector3Int) ref keyValuePair.Value.limitSize).get_y(), (object)((Vector3Int) ref keyValuePair.Value.limitSize).get_z());
         ObservableExtensions.Subscribe <bool>(Observable.Where <bool>((IObservable <M0>)UnityUIComponentExtensions.OnValueChangedAsObservable(component.toggle), (Func <M0, bool>)(_b => _b)), (Action <M0>)(_ => this.SelectTab(type, false)));
         this.dicTabInfo[type] = new HousingLoadWindow.TabInfo()
         {
             gameObject = gameObject,
             sizeTab    = component
         };
     }
     for (int index = 0; index < this.buttonsThumbnail.Length; ++index)
     {
         int idx = index;
         ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(this.buttonsThumbnail[index]), (Action <M0>)(_ =>
         {
             int num     = this.thumbnailLimit * this.page + idx;
             this.select = this.backSelect == num ? -1 : num;
             this.UpdateSelectImage();
             if (this.onSelect != null)
             {
                 this.onSelect(this.select);
             }
             this.backSelect = this.select;
         }));
     }
     this.dicTabInfo[0].IsOn = true;
     this.SelectTab(0, false);
 }
Exemplo n.º 2
0
        public override void Init(UICtrl _uiCtrl, bool _tutorial)
        {
            base.Init(_uiCtrl, _tutorial);
            ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable((Button)this.buttonClose), (Action <M0>)(_ => this.Close()));
            foreach (KeyValuePair <int, Manager.Housing.AreaSizeInfo> keyValuePair in Singleton <Manager.Housing> .Instance.dicAreaSizeInfo)
            {
                GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.tabOriginal, this.tabRoot);
                gameObject.SetActive(true);
                SizeTab component = (SizeTab)gameObject.GetComponent <SizeTab>();
                int     type      = keyValuePair.Value.no;
                component.Text = string.Format("{0}X{1}X{2}", (object)((Vector3Int) ref keyValuePair.Value.limitSize).get_x(), (object)((Vector3Int) ref keyValuePair.Value.limitSize).get_y(), (object)((Vector3Int) ref keyValuePair.Value.limitSize).get_z());
                ObservableExtensions.Subscribe <bool>(Observable.Where <bool>((IObservable <M0>)UnityUIComponentExtensions.OnValueChangedAsObservable(component.toggle), (Func <M0, bool>)(_b => _b)), (Action <M0>)(_ => this.SelectTab(type, false)));
                this.dicTabInfo[type] = new SaveLoadUICtrl.TabInfo()
                {
                    gameObject = gameObject,
                    sizeTab    = component
                };
            }
            for (int index = 0; index < this.buttonsThumbnail.Length; ++index)
            {
                int idx = index;
                ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(this.buttonsThumbnail[index]), (Action <M0>)(_ =>
                {
                    this.infoLoad.Setup(this.rawsThumbnail[idx].get_texture());
                    this.select = this.thumbnailLimit * this.page + idx;
                }));
            }
            ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable((Button)this.infoLoad.buttonClose), (Action <M0>)(_ => this.infoLoad.Visible = false));
            ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable((Button)this.infoLoad.buttonDelete), (Action <M0>)(_ =>
            {
                ConfirmScene.Sentence     = "データを消去しますか?";
                ConfirmScene.OnClickedYes = (Action)(() =>
                {
                    File.Delete(this.listPath[this.select]);
                    this.InitInfo(this.tab);
                    this.SetPage(this.page, true);
                    this.infoLoad.Visible = false;
                });
                ConfirmScene.OnClickedNo = (Action)(() => {});
                Singleton <Game> .Instance.LoadDialog();
            }));
            ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable((Button)this.infoLoad.buttonLoad), (Action <M0>)(_ =>
            {
                ConfirmScene.Sentence     = "データを読込みますか?\n" + "セットされたアイテムは削除されます。".Coloring("#DE4529FF").Size(24);
                ConfirmScene.OnClickedYes = (Action)(() =>
                {
                    Singleton <Selection> .Instance.SetSelectObjects((ObjectCtrl[])null);
                    this.UICtrl.ListUICtrl.ClearList();
                    Singleton <UndoRedoManager> .Instance.Clear();
                    this.Visible = false;
                    Singleton <CraftScene> .Instance.WorkingUICtrl.Visible = true;
                    Singleton <Manager.Housing> .Instance.LoadAsync(this.listPath[this.select], (Action <bool>)(_b =>
                    {
                        this.UICtrl.ListUICtrl.UpdateUI();
                        Singleton <CraftScene> .Instance.WorkingUICtrl.Visible = false;
                        this.Close();
                    }));
                });
                ConfirmScene.OnClickedNo = (Action)(() => {});
                Singleton <Game> .Instance.LoadDialog();
            }));
            ObservableExtensions.Subscribe <bool>((IObservable <M0>) this.visibleReactive, (Action <M0>)(_b =>
            {
                this.canvasGroup.Enable(_b, false);
                if (!_b)
                {
                    return;
                }
                this.buttonClose.ClearState();
                this.infoLoad.Visible = false;
            }));
            int housingId = Singleton <CraftScene> .Instance.HousingID;

            Manager.Housing.AreaInfo areaInfo = (Manager.Housing.AreaInfo)null;
            if (Singleton <Manager.Housing> .Instance.dicAreaInfo.TryGetValue(housingId, out areaInfo))
            {
                Manager.Housing.AreaSizeInfo areaSizeInfo = (Manager.Housing.AreaSizeInfo)null;
                if (Singleton <Manager.Housing> .Instance.dicAreaSizeInfo.TryGetValue(areaInfo.size, out areaSizeInfo))
                {
                    foreach (KeyValuePair <int, SaveLoadUICtrl.TabInfo> keyValuePair in this.dicTabInfo)
                    {
                        keyValuePair.Value.Interactable = areaSizeInfo.compatibility.Contains(keyValuePair.Key);
                    }
                }
            }
            this.Visible = false;
        }