Exemplo n.º 1
0
        private void InitializeCommandLabels()
        {
            if (!((IReadOnlyList <CommandLabel.CommandInfo>) this.Labels).IsNullOrEmpty <CommandLabel.CommandInfo>())
            {
                return;
            }
            CommonDefine.CommonIconGroup icon = Singleton <Resources> .Instance.CommonDefine.Icon;
            Sprite    sprite    = (Sprite)null;
            Resources instance1 = Singleton <Resources> .Instance;

            Manager.Map instance2 = Singleton <Manager.Map> .Instance;
            instance1.itemIconTables.ActionIconTable.TryGetValue(icon.FishTankIconID, out sprite);
            this.Labels = new CommandLabel.CommandInfo[1]
            {
                new CommandLabel.CommandInfo()
                {
                    Text             = "水槽",
                    Icon             = sprite,
                    IsHold           = true,
                    TargetSpriteInfo = icon.ActionSpriteInfo,
                    Transform        = this.LabelPoint,
                    Condition        = (Func <PlayerActor, bool>)null,
                    Event            = (Action)(() => Debug.Log((object)"水槽:魚追加UIを表示する"))
                }
            };
        }
Exemplo n.º 2
0
        protected override void InitializeCommandLabels()
        {
            if (!((IReadOnlyList <CommandLabel.CommandInfo>) this.getLabels).IsNullOrEmpty <CommandLabel.CommandInfo>())
            {
                return;
            }
            CommonDefine commonDefine = !Singleton <Resources> .IsInstance() ? (CommonDefine)null : Singleton <Resources> .Instance.CommonDefine;

            CommonDefine.CommonIconGroup commonIconGroup = !Object.op_Inequality((Object)commonDefine, (Object)null) ? (CommonDefine.CommonIconGroup)null : commonDefine.Icon;
            Resources instance      = Singleton <Resources> .Instance;
            int       guideCancelId = commonIconGroup.GuideCancelID;
            Sprite    sprite;

            instance.itemIconTables.InputIconTable.TryGetValue(guideCancelId, out sprite);
            List <string> source;

            instance.Map.EventPointCommandLabelTextTable.TryGetValue(0, out source);
            int index = !Singleton <GameSystem> .IsInstance() ? 0 : Singleton <GameSystem> .Instance.languageInt;

            this.getLabels = new CommandLabel.CommandInfo[1]
            {
                new CommandLabel.CommandInfo()
                {
                    Text             = source.GetElement <string>(index),
                    Transform        = this.LabelPoint,
                    IsHold           = false,
                    Icon             = sprite,
                    TargetSpriteInfo = commonIconGroup?.CharaSpriteInfo,
                    Event            = (System.Action)(() =>
                    {
                        PlayerActor playerActor           = !Singleton <Manager.Map> .IsInstance() ? (PlayerActor)null : Singleton <Manager.Map> .Instance.Player;
                        PlayerController playerController = !Object.op_Inequality((Object)playerActor, (Object)null) ? (PlayerController)null : playerActor.PlayerController;
                        EventPoint.SetCurrentPlayerStateName();
                        if (Object.op_Inequality((Object)playerController, (Object)null))
                        {
                            playerController.ChangeState("Idle");
                        }
                        RequestUI requestUi = MapUIContainer.RequestUI;
                        requestUi.SubmitEvent     = (System.Action)(() => this.GetMecha());
                        requestUi.SubmitCondition = (Func <bool>)(() => this.CanGet());
                        requestUi.ClosedEvent     = (System.Action)(() => EventPoint.ChangePrevPlayerMode());
                        requestUi.Open(Popup.Request.Type.Cuby);
                        if (!requestUi.IsImpossible)
                        {
                            return;
                        }
                        MapUIContainer.PushWarningMessage(Popup.Warning.Type.InsufficientBattery);
                    })
                }
            };
        }
Exemplo n.º 3
0
        protected override void InitializeCommandLabels()
        {
            if (!((IReadOnlyList <CommandLabel.CommandInfo>) this.getLabels).IsNullOrEmpty <CommandLabel.CommandInfo>())
            {
                return;
            }
            CommonDefine commonDefine = !Singleton <Resources> .IsInstance() ? (CommonDefine)null : Singleton <Resources> .Instance.CommonDefine;

            CommonDefine.CommonIconGroup commonIconGroup = !Object.op_Inequality((Object)commonDefine, (Object)null) ? (CommonDefine.CommonIconGroup)null : commonDefine.Icon;
            this.getLabels = new CommandLabel.CommandInfo[1]
            {
                new CommandLabel.CommandInfo()
                {
                    Text             = "捕まえる",
                    Transform        = ((Component)this).get_transform(),
                    IsHold           = false,
                    Icon             = (Sprite)null,
                    TargetSpriteInfo = commonIconGroup?.CharaSpriteInfo,
                    Event            = (Action)(() =>
                    {
                        StuffItemInfo itemInfo = this.ItemInfo;
                        if (itemInfo != null)
                        {
                            StuffItem stuffItem = new StuffItem(itemInfo.CategoryID, itemInfo.ID, 1);
                            Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList.AddItem(stuffItem);
                            MapUIContainer.AddSystemItemLog(itemInfo, stuffItem.Count, true);
                        }
                        else
                        {
                            MapUIContainer.AddNotify(MapUIContainer.ItemGetEmptyText);
                        }
                        this.Destroy();
                    })
                }
            };
        }
Exemplo n.º 4
0
        protected override void InitializeCommandLabels()
        {
            if (!((IReadOnlyList <CommandLabel.CommandInfo>) this.getLabels).IsNullOrEmpty <CommandLabel.CommandInfo>())
            {
                return;
            }
            CommonDefine commonDefine = !Singleton <Resources> .IsInstance() ? (CommonDefine)null : Singleton <Resources> .Instance.CommonDefine;

            CommonDefine.CommonIconGroup commonIconGroup = !Object.op_Inequality((Object)commonDefine, (Object)null) ? (CommonDefine.CommonIconGroup)null : commonDefine.Icon;
            Resources instance      = Singleton <Resources> .Instance;
            int       guideCancelId = commonIconGroup.GuideCancelID;
            Sprite    sprite;

            instance.itemIconTables.InputIconTable.TryGetValue(guideCancelId, out sprite);
            List <string> source;

            instance.Map.EventPointCommandLabelTextTable.TryGetValue(18, out source);
            int index = !Singleton <GameSystem> .IsInstance() ? 0 : Singleton <GameSystem> .Instance.languageInt;

            this.getLabels = new CommandLabel.CommandInfo[1]
            {
                new CommandLabel.CommandInfo()
                {
                    Text             = source.GetElement <string>(index),
                    Transform        = this.LabelPoint,
                    IsHold           = false,
                    Icon             = sprite,
                    TargetSpriteInfo = commonIconGroup?.CharaSpriteInfo,
                    Event            = (System.Action)(() =>
                    {
                        bool flag1 = true;
                        if (Object.op_Inequality((Object)this.habitatPoint, (Object)null) && Singleton <Resources> .IsInstance() && Singleton <Manager.Map> .IsInstance())
                        {
                            PlayerActor player = Singleton <Manager.Map> .Instance.Player;
                            Dictionary <int, ItemTableElement> tableInFrogPoint = Singleton <Resources> .Instance.GameInfo.GetItemTableInFrogPoint(this.habitatPoint.ItemID);
                            Actor.SearchInfo searchInfo = player.RandomAddItem(tableInFrogPoint, true);
                            if (searchInfo.IsSuccess)
                            {
                                bool flag2 = false;
                                foreach (Actor.ItemSearchInfo itemSearchInfo in searchInfo.ItemList)
                                {
                                    PlayerData playerData     = player.PlayerData;
                                    List <StuffItem> itemList = playerData.ItemList;
                                    StuffItem stuffItem       = new StuffItem(itemSearchInfo.categoryID, itemSearchInfo.id, itemSearchInfo.count);
                                    int possible;
                                    if (StuffItemExtensions.CanAddItem((IReadOnlyCollection <StuffItem>)itemList, playerData.InventorySlotMax, stuffItem, out possible) && 0 < possible)
                                    {
                                        int count = Mathf.Min(possible, itemSearchInfo.count);
                                        itemList.AddItem(stuffItem, count, playerData.InventorySlotMax);
                                        MapUIContainer.AddSystemItemLog(Singleton <Resources> .Instance.GameInfo.GetItem(itemSearchInfo.categoryID, itemSearchInfo.id), count, true);
                                        flag2 = true;
                                    }
                                }
                                if (!flag2)
                                {
                                    flag1 = false;
                                    MapUIContainer.PushWarningMessage(Popup.Warning.Type.PouchIsFull);
                                }
                            }
                            else
                            {
                                MapUIContainer.AddNotify(MapUIContainer.ItemGetEmptyText);
                            }
                        }
                        if (!flag1)
                        {
                            return;
                        }
                        this.Destroy();
                    })
                }
            };
        }
Exemplo n.º 5
0
        private void InitializeCommandLabels()
        {
            Resources resources = !Singleton <Resources> .IsInstance() ? (Resources)null : Singleton <Resources> .Instance;

            if (Object.op_Equality((Object)resources, (Object)null))
            {
                return;
            }
            CommonDefine.CommonIconGroup     icon = resources.CommonDefine.Icon;
            ValueTuple <int, List <string> > valueTuple;

            resources.AnimalTable.PetHomeUIInfoTable.TryGetValue((int)this._homeKind, out valueTuple);
            Dictionary <int, Sprite> actionIconTable = resources.itemIconTables.ActionIconTable;
            Sprite sprite = (Sprite)null;

            actionIconTable.TryGetValue((int)valueTuple.Item1, out sprite);
            int index = !Singleton <GameSystem> .IsInstance() ? 0 : Singleton <GameSystem> .Instance.languageInt;

            switch (this._homeKind)
            {
            case PetHomePoint.HomeKind.PetMat:
                this._labels = new CommandLabel.CommandInfo[1]
                {
                    new CommandLabel.CommandInfo()
                    {
                        Text             = ((List <string>)valueTuple.Item2).GetElement <string>(index),
                        Icon             = sprite,
                        IsHold           = true,
                        TargetSpriteInfo = icon.ActionSpriteInfo,
                        Transform        = this.LabelPoint,
                        Condition        = (Func <PlayerActor, bool>)null,
                        Event            = (Action)(() =>
                        {
                            PlayerActor playerActor = !Singleton <Manager.Map> .IsInstance() ? (PlayerActor)null : Singleton <Manager.Map> .Instance.Player;
                            if (Object.op_Equality((Object)playerActor, (Object)null))
                            {
                                return;
                            }
                            playerActor.CurrentPetHomePoint = this;
                            MapUIContainer.SetActivePetHomeUI(true);
                            playerActor.PlayerController.ChangeState("Harvest");
                        })
                    }
                };
                break;

            case PetHomePoint.HomeKind.FishTank:
                this._labels = new CommandLabel.CommandInfo[1]
                {
                    new CommandLabel.CommandInfo()
                    {
                        Text             = ((List <string>)valueTuple.Item2).GetElement <string>(index),
                        Icon             = sprite,
                        IsHold           = true,
                        TargetSpriteInfo = icon.ActionSpriteInfo,
                        Transform        = this.LabelPoint,
                        Condition        = (Func <PlayerActor, bool>)null,
                        Event            = (Action)(() =>
                        {
                            PlayerActor playerActor = !Singleton <Manager.Map> .IsInstance() ? (PlayerActor)null : Singleton <Manager.Map> .Instance.Player;
                            if (Object.op_Equality((Object)playerActor, (Object)null))
                            {
                                return;
                            }
                            playerActor.CurrentPetHomePoint = this;
                            MapUIContainer.SetActivePetHomeUI(true);
                            playerActor.PlayerController.ChangeState("Harvest");
                        })
                    }
                };
                break;
            }
        }
Exemplo n.º 6
0
        protected override void InitializeCommandLabels()
        {
            if (!Singleton <Resources> .IsInstance())
            {
                return;
            }
            if (((IReadOnlyList <CommandLabel.CommandInfo>) this.giveFoodLabels).IsNullOrEmpty <CommandLabel.CommandInfo>())
            {
                Resources instance = Singleton <Resources> .Instance;
                CommonDefine.CommonIconGroup icon = instance.CommonDefine.Icon;
                StuffItemInfo stuffItemInfo       = !Singleton <Resources> .IsInstance() ? (StuffItemInfo)null : Singleton <Resources> .Instance.GameInfo.GetItem(this.foodItemID.categoryID, this.foodItemID.itemID);

                int    guideCancelId = icon.GuideCancelID;
                Sprite sprite;
                instance.itemIconTables.InputIconTable.TryGetValue(guideCancelId, out sprite);
                string _foodItemName = stuffItemInfo?.Name ?? "エサ";
                Dictionary <int, List <string> > commandLabelTextTable = instance.Map.EventPointCommandLabelTextTable;
                List <string> source;
                commandLabelTextTable.TryGetValue(19, out source);
                List <string> _textList1;
                commandLabelTextTable.TryGetValue(20, out _textList1);
                int _langIdx = !Singleton <GameSystem> .IsInstance() ? 0 : Singleton <GameSystem> .Instance.languageInt;

                this.giveFoodLabels = new CommandLabel.CommandInfo[1]
                {
                    new CommandLabel.CommandInfo()
                    {
                        Text             = string.Format(source.GetElement <string>(_langIdx) ?? "{0}をあげる", (object)_foodItemName),
                        Transform        = this.LabelPoint,
                        IsHold           = false,
                        Icon             = sprite,
                        TargetSpriteInfo = icon?.CharaSpriteInfo,
                        Condition        = (Func <PlayerActor, bool>)(_player => this.HaveFoodItem()),
                        ErrorText        = (Func <PlayerActor, string>)(_player => string.Format(_textList1.GetElement <string>(_langIdx) ?? "{0}を持っていません。", (object)_foodItemName)),
                        Event            = (Action)(() =>
                        {
                            this.ChangeEmptyLabels();
                            List <StuffItem> self = !Singleton <Manager.Map> .IsInstance() ? (List <StuffItem>)null : Singleton <Manager.Map> .Instance.Player?.PlayerData?.ItemList;
                            if (!((IReadOnlyList <StuffItem>)self).IsNullOrEmpty <StuffItem>())
                            {
                                self.RemoveItem(new StuffItem(this.foodItemID.categoryID, this.foodItemID.itemID, 1));
                            }
                            if (this.CurrentState != AnimalState.Sleep)
                            {
                                this.SetState(AnimalState.LovelyIdle, (Action)(() => this.ChangeGetAnimalLabels()));
                            }
                            else
                            {
                                this.ChangeGetAnimalLabels();
                            }
                            float num = 120f;
                            if (Singleton <Resources> .IsInstance())
                            {
                                AnimalDefinePack animalDefinePack = Singleton <Resources> .Instance.AnimalDefinePack;
                                if (animalDefinePack?.GroundWildInfo != null)
                                {
                                    num = animalDefinePack.GroundWildInfo.LovelyTime;
                                }
                            }
                            if (this.lovelyModeDisposable != null)
                            {
                                this.lovelyModeDisposable.Dispose();
                            }
                            this.lovelyModeDisposable = ObservableExtensions.Subscribe <long>(Observable.Do <long>(Observable.TakeUntilDestroy <long>((IObservable <M0>)Observable.Timer(TimeSpan.FromSeconds((double)num)), ((Component)this).get_gameObject()), (Action <M0>)(_ => this.lovelyModeDisposable = (IDisposable)null)), (Action <M0>)(_ =>
                            {
                                if (this.IsLovely)
                                {
                                    this.ChangeEmptyLabels();
                                }
                                switch (this.CurrentState)
                                {
                                case AnimalState.LovelyIdle:
                                    this.SetState(AnimalState.Locomotion, (Action)(() => this.ChangeAnimalLabel()));
                                    break;

                                case AnimalState.LovelyFollow:
                                    this.SetState(AnimalState.Idle, (Action)(() => this.ChangeAnimalLabel()));
                                    break;

                                default:
                                    this.ChangeAnimalLabel();
                                    break;
                                }
                            }));
                        })
                    }
                };
            }
            string _getItemName = (!Singleton <Resources> .IsInstance() ? (StuffItemInfo)null : Singleton <Resources> .Instance.GameInfo.GetItem(this.getItemID.categoryID, this.getItemID.itemID))?.Name ?? "捕獲アイテム";

            if (!((IReadOnlyList <CommandLabel.CommandInfo>) this.getAnimalLabels).IsNullOrEmpty <CommandLabel.CommandInfo>())
            {
                return;
            }
            Resources instance1 = Singleton <Resources> .Instance;

            CommonDefine.CommonIconGroup icon1 = instance1.CommonDefine.Icon;
            int    guideCancelId1 = icon1.GuideCancelID;
            Sprite sprite1;

            instance1.itemIconTables.InputIconTable.TryGetValue(guideCancelId1, out sprite1);
            Dictionary <int, List <string> > commandLabelTextTable1 = instance1.Map.EventPointCommandLabelTextTable;
            List <string> source1;

            commandLabelTextTable1.TryGetValue(21, out source1);
            List <string> _textList1_1;

            commandLabelTextTable1.TryGetValue(20, out _textList1_1);
            int _langIdx1 = !Singleton <GameSystem> .IsInstance() ? 0 : Singleton <GameSystem> .Instance.languageInt;

            this.getAnimalLabels = new CommandLabel.CommandInfo[1]
            {
                new CommandLabel.CommandInfo()
                {
                    Text             = string.Format(source1.GetElement <string>(_langIdx1) ?? "{0}を捕まえる", (object)this.Name),
                    Transform        = this.LabelPoint,
                    IsHold           = false,
                    Icon             = sprite1,
                    Condition        = (Func <PlayerActor, bool>)(_player => this.HaveGetItem()),
                    ErrorText        = (Func <PlayerActor, string>)(_player => string.Format(_textList1_1.GetElement <string>(_langIdx1) ?? "{0}を持っていません。", (object)_getItemName)),
                    TargetSpriteInfo = icon1?.CharaSpriteInfo,
                    Event            = (Action)(() =>
                    {
                        this.ChangeEmptyLabels();
                        this.SetState(AnimalState.WithPlayer, (Action)null);
                        PlayerActor playerActor = !Singleton <Manager.Map> .IsInstance() ? (PlayerActor)null : Singleton <Manager.Map> .Instance.Player;
                        if (!Object.op_Inequality((Object)playerActor, (Object)null))
                        {
                            return;
                        }
                        playerActor.Animal = (AnimalBase)this;
                        playerActor.PlayerController.ChangeState("CatchAnimal");
                    })
                }
            };
        }