Exemplo n.º 1
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;
            }
        }