public virtual TaskStatus OnUpdate()
        {
            AgentActor agent = this.Agent;
            Dictionary <int, CollisionState> collisionStateTable = agent.ActionPointCollisionStateTable;
            List <ActionPoint> toRelease = ListPool <ActionPoint> .Get();

            foreach (ActionPoint searchTarget in agent.SearchTargets)
            {
                CollisionState collisionState;
                if (collisionStateTable.TryGetValue(searchTarget.InstanceID, out collisionState) && collisionState == CollisionState.Enter)
                {
                    toRelease.Add(searchTarget);
                }
            }
            if (toRelease.Count > 0)
            {
                List <ActionPoint> actionPointList = ListPool <ActionPoint> .Get();

                foreach (ActionPoint actionPoint in toRelease)
                {
                    if (actionPoint.IsNeutralCommand)
                    {
                        actionPointList.Add(actionPoint);
                    }
                }
                Desire.Type requestedDesire = agent.RequestedDesire;
                EventType   type            = (EventType)0;
                foreach (ValueTuple <EventType, Desire.Type> valuePair in Desire.ValuePairs)
                {
                    if ((Desire.Type)valuePair.Item2 == requestedDesire)
                    {
                        type = (EventType)valuePair.Item1;
                        break;
                    }
                }
                ActionPoint point = (ActionPoint)null;
                foreach (ActionPoint actionPoint in actionPointList)
                {
                    if (Object.op_Inequality((Object)agent.Partner, (Object)null))
                    {
                        if (actionPoint.AgentDateEventType.Contains(type))
                        {
                            point = actionPoint;
                        }
                    }
                    else if (actionPoint.AgentEventType.Contains(type))
                    {
                        point = actionPoint;
                    }
                }
                if (Object.op_Equality((Object)point, (Object)null))
                {
                    point = actionPointList.GetElement <ActionPoint>(Random.Range(0, actionPointList.Count));
                    if (Object.op_Equality((Object)point, (Object)null))
                    {
                        ListPool <ActionPoint> .Release(actionPointList);

                        ListPool <ActionPoint> .Release(toRelease);

                        return((TaskStatus)1);
                    }
                }
                ListPool <ActionPoint> .Release(actionPointList);

                if (Debug.get_isDebugBuild())
                {
                    if (Object.op_Inequality((Object)agent.Partner, (Object)null))
                    {
                        Debug.Log((object)string.Format("{0} :: Enter Point In Sight: {1} <{2}>", (object)((Object)((Component)agent).get_gameObject()).get_name(), (object)((Object)point).get_name(), (object)point.AgentDateEventType));
                    }
                    else
                    {
                        Debug.Log((object)string.Format("{0} :: Enter Point In Sight: {1} <{2}>", (object)((Object)((Component)agent).get_gameObject()).get_name(), (object)((Object)point).get_name(), (object)point.AgentEventType));
                    }
                }
                if (requestedDesire == Desire.Type.Bath && type == EventType.DressIn && (double)agent.ChaControl.fileGameInfo.flavorState[2] < (double)Singleton <Resources> .Instance.StatusProfile.CanDressBorder)
                {
                    type = EventType.Bath;
                }
                if (type == EventType.Eat)
                {
                    StuffItem       carryingItem     = agent.AgentData.CarryingItem;
                    AgentProfile    agentProfile     = Singleton <Resources> .Instance.AgentProfile;
                    ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems;
                    bool            flag             = false;
                    foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems)
                    {
                        if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID)
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (flag)
                    {
                        PoseKeyPair     eatDeskId  = agentProfile.PoseIDTable.EatDeskID;
                        PoseKeyPair     eatChairId = agentProfile.PoseIDTable.EatChairID;
                        ActionPointInfo outInfo;
                        if (!point.FindAgentActionPointInfo(EventType.Eat, eatDeskId.poseID, out outInfo) && !point.FindAgentActionPointInfo(EventType.Eat, eatChairId.poseID, out outInfo))
                        {
                            return((TaskStatus)1);
                        }
                    }
                    else
                    {
                        PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID;
                        if (!point.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out ActionPointInfo _))
                        {
                            return((TaskStatus)1);
                        }
                    }
                }
                switch (agent.AgentController.GetPermission(point))
                {
                case AgentController.PermissionStatus.Prohibition:
                    Debug.Log((object)string.Format("目的地落選: {0}", (object)((Object)point).get_name()));
                    break;

                case AgentController.PermissionStatus.Permission:
                    Debug.Log((object)string.Format("目的地当選: {0}", (object)((Object)point).get_name()));
                    if (type == (EventType)0)
                    {
                        Debug.LogError((object)string.Format("EventType該当なし: {0}", (object)requestedDesire));
                    }
                    agent.EventKey = type;
                    agent.TargetInSightActionPoint = point;
                    agent.RuntimeDesire            = agent.RequestedDesire;
                    break;
                }
            }
            ListPool <ActionPoint> .Release(toRelease);

            if (!Object.op_Inequality((Object)agent.TargetInSightActionPoint, (Object)null))
            {
                return((TaskStatus)1);
            }
            agent.ClearReservedNearActionWaypoints();
            agent.AbortActionPatrol();
            return((TaskStatus)2);
        }
Example #2
0
        public virtual void OnStart()
        {
            ((Task)this).OnStart();
            this._agent = this.Agent;
            this._agent.RuntimeMotivationInPhoto = this._agent.AgentData.StatsTable[5];
            this._prevStateType   = this._agent.StateType;
            this._agent.StateType = AIProject.Definitions.State.Type.Immobility;
            this._poseIDList      = ListPool <int> .Get();

            NavMeshAgent navMeshAgent = this._agent.NavMeshAgent;

            navMeshAgent.set_isStopped(true);
            this._prevPriority = navMeshAgent.get_avoidancePriority();
            navMeshAgent.set_avoidancePriority(Singleton <Resources> .Instance.AgentProfile.AvoidancePriorityStationary);
            this._player          = Singleton <Manager.Map> .Instance.Player;
            this._playerCameraCon = this._player.CameraControl;
            this._prevShotType    = this._playerCameraCon.ShotType;
            this._isFadeOut       = false;
            this._poseStateTable  = (ReadOnlyDictionary <int, ValueTuple <PoseKeyPair, bool> >)null;
            this._poseInfo        = new ValueTuple <PoseKeyPair, bool>(new PoseKeyPair(), false);
            Dictionary <int, ValueTuple <PoseKeyPair, bool> > source;

            if (Singleton <Resources> .Instance.Animation.AgentGravurePoseTable.TryGetValue(this._agent.ChaControl.fileParam.personality, out source) && !source.IsNullOrEmpty <int, ValueTuple <PoseKeyPair, bool> >())
            {
                this._poseStateTable = new ReadOnlyDictionary <int, ValueTuple <PoseKeyPair, bool> >((IDictionary <int, ValueTuple <PoseKeyPair, bool> >)source);
                this._poseIDList.AddRange((IEnumerable <int>) this._poseStateTable.get_Keys());
                this._lastPoseID = this._poseIDList[Random.Range(0, this._poseIDList.Count)];
                this._poseStateTable.TryGetValue(this._lastPoseID, ref this._poseInfo);
            }
            this._poseOutAnimAction = new Subject <Unit>();
            ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>) this._poseOutAnimAction, (Component)this._agent), 1), (System.Action <M0>)(_ =>
            {
                this._isFadeOut = true;
                this.PlayOutAnimation(this._poseInfo);
                this._isWait = (Func <AgentActor, bool>)(actor => actor.Animation.PlayingOutAnimation);
            }));
            this._poseReplayAnimAction = new Subject <Unit>();
            ObservableExtensions.Subscribe <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>) this._poseReplayAnimAction, (Component)this._agent), (System.Action <M0>)(_ =>
            {
                if (this._poseIDList.IsNullOrEmpty <int>())
                {
                    this._poseOutAnimAction.OnNext(Unit.get_Default());
                }
                else
                {
                    if (this._poseIDList.Count == 1)
                    {
                        this._agent.ClearItems();
                        this.PlayInAnimation(this._poseInfo);
                    }
                    else
                    {
                        List <int> toRelease = ListPool <int> .Get();
                        toRelease.AddRange((IEnumerable <int>) this._poseIDList);
                        toRelease.Remove(this._lastPoseID);
                        this._lastPoseID = toRelease[Random.Range(0, toRelease.Count)];
                        ListPool <int> .Release(toRelease);
                        this._poseStateTable.TryGetValue(this._lastPoseID, ref this._poseInfo);
                        this._agent.ClearItems();
                        this.PlayInAnimation(this._poseInfo);
                    }
                    this._isWait      = (Func <AgentActor, bool>)(actor => actor.Animation.PlayingInAnimation);
                    this._onEndAction = (Subject <Unit>)null;
                }
            }));
            this._poseLoopEndAnimAction = new Subject <Unit>();
            ObservableExtensions.Subscribe <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>) this._poseLoopEndAnimAction, (Component)this._agent), (System.Action <M0>)(_ =>
            {
                this.PlayOutAnimation(this._poseInfo);
                this._isWait      = (Func <AgentActor, bool>)(actor => actor.Animation.PlayingOutAnimation);
                this._onEndAction = this._poseReplayAnimAction;
            }));
            this.PlayInAnimation(this._poseInfo);
            this._isWait      = (Func <AgentActor, bool>)(actor => actor.Animation.PlayingInAnimation);
            this._onEndAction = (Subject <Unit>)null;
        }
        public void RefreshTemperatureValue()
        {
            if (!Singleton <Resources> .IsInstance())
            {
                return;
            }
            Dictionary <int, Dictionary <int, Dictionary <int, List <ValueTuple <int, int> > > > > tempRangeTable = Singleton <Resources> .Instance.Map.TempRangeTable;

            if (tempRangeTable.IsNullOrEmpty <int, Dictionary <int, Dictionary <int, List <ValueTuple <int, int> > > > >())
            {
                return;
            }
            Dictionary <int, Dictionary <int, List <ValueTuple <int, int> > > > source1;

            if (!tempRangeTable.TryGetValue(this.MapID, out source1) || source1.IsNullOrEmpty <int, Dictionary <int, List <ValueTuple <int, int> > > >())
            {
                if (this.MapID != 0)
                {
                    tempRangeTable.TryGetValue(0, out source1);
                }
                if (source1.IsNullOrEmpty <int, Dictionary <int, List <ValueTuple <int, int> > > >())
                {
                    return;
                }
            }
            int key;
            Dictionary <int, List <ValueTuple <int, int> > > source2;
            List <ValueTuple <int, int> > source3;

            if (!AIProject.Definitions.Environment.TimeZoneIDTable.TryGetValue(this._tempTimeZone, ref key) || !source1.TryGetValue(key, out source2) || (source2.IsNullOrEmpty <int, List <ValueTuple <int, int> > >() || !source2.TryGetValue((int)this._weather, out source3)) || source3.IsNullOrEmpty <ValueTuple <int, int> >())
            {
                return;
            }
            List <ValueTuple <int, int> > toRelease = ListPool <ValueTuple <int, int> > .Get();

            toRelease.AddRange((IEnumerable <ValueTuple <int, int> >)source3);
            int num1 = 0;

            using (List <ValueTuple <int, int> > .Enumerator enumerator = toRelease.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ValueTuple <int, int> current = enumerator.Current;
                    num1 += (int)current.Item2;
                }
            }
            int num2 = Random.Range(0, num1);

            while (0 < toRelease.Count)
            {
                ValueTuple <int, int> valueTuple = ((IList <ValueTuple <int, int> >)toRelease).PopFront <ValueTuple <int, int> >();
                if (num2 < valueTuple.Item2)
                {
                    this.TemperatureValue = (float)valueTuple.Item1;
                    ListPool <ValueTuple <int, int> > .Release(toRelease);

                    return;
                }
                num2 -= (int)valueTuple.Item2;
            }
            ListPool <ValueTuple <int, int> > .Release(toRelease);
        }
Example #4
0
        protected override void InitSub()
        {
            this._offMeshLink  = (OffMeshLink)((Component)this).GetComponent <OffMeshLink>();
            this.DoorAnimation = (DoorAnimation)((Component)this).GetComponent <DoorAnimation>();
            CommonDefine.CommonIconGroup icon          = Singleton <Resources> .Instance.CommonDefine.Icon;
            EventType playerEventMask                  = Singleton <Resources> .Instance.DefinePack.MapDefines.PlayerEventMask;
            List <CommandLabel.CommandInfo> toRelease1 = ListPool <CommandLabel.CommandInfo> .Get();

            List <CommandLabel.CommandInfo> toRelease2 = ListPool <CommandLabel.CommandInfo> .Get();

            foreach (KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > keyValuePair in ActionPoint.LabelTable)
            {
                KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > pair = keyValuePair;
                DoorPoint doorPoint = this;
                if (this._playerEventType.Contains(pair.Key) && playerEventMask.Contains(pair.Key) && AIProject.Definitions.Action.NameTable.TryGetValue(pair.Key, out ValueTuple <int, string> _))
                {
                    ActionPointInfo actionPointInfo = this._playerInfos.Find((Predicate <ActionPointInfo>)(x => x.eventTypeMask == pair.Key));
                    string          actionName      = actionPointInfo.actionName;
                    Sprite          sprite;
                    Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(actionPointInfo.iconID, out sprite);

                    Transform transform = ((Component)this).get_transform().FindLoop(actionPointInfo.labelNullName)?.get_transform() ?? ((Component)this).get_transform();
                    if (pair.Key == EventType.DoorOpen)
                    {
                        toRelease1.Add(new CommandLabel.CommandInfo()
                        {
                            Text             = actionName,
                            Icon             = sprite,
                            IsHold           = false,
                            TargetSpriteInfo = icon.ActionSpriteInfo,
                            Transform        = transform,
                            Event            = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)doorPoint))
                        });
                        if (actionPointInfo.doorOpenType > -1)
                        {
                            this._openType = (DoorPoint.OpenTypeState)actionPointInfo.doorOpenType;
                        }
                    }
                    else if (pair.Key == EventType.DoorClose)
                    {
                        toRelease2.Add(new CommandLabel.CommandInfo()
                        {
                            Text             = actionName,
                            Icon             = sprite,
                            IsHold           = false,
                            TargetSpriteInfo = icon.ActionSpriteInfo,
                            Transform        = transform,
                            Event            = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)doorPoint))
                        });
                        if (actionPointInfo.doorOpenType > -1)
                        {
                            this._openType = (DoorPoint.OpenTypeState)actionPointInfo.doorOpenType;
                        }
                    }
                }
            }
            this._openingLabels = toRelease1.ToArray();
            this._closingLabels = toRelease2.ToArray();
            ListPool <CommandLabel.CommandInfo> .Release(toRelease1);

            ListPool <CommandLabel.CommandInfo> .Release(toRelease2);

            List <CommandLabel.CommandInfo> toRelease3 = ListPool <CommandLabel.CommandInfo> .Get();

            List <CommandLabel.CommandInfo> toRelease4 = ListPool <CommandLabel.CommandInfo> .Get();

            foreach (KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > keyValuePair in ActionPoint.SickLabelTable)
            {
                KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > pair = keyValuePair;
                DoorPoint doorPoint = this;
                if (this._playerEventType.Contains(pair.Key) && AIProject.Definitions.Action.NameTable.TryGetValue(pair.Key, out ValueTuple <int, string> _))
                {
                    ActionPointInfo actionPointInfo = this._playerInfos.Find((Predicate <ActionPointInfo>)(x => x.eventTypeMask == pair.Key));
                    string          actionName      = actionPointInfo.actionName;
                    Sprite          sprite;
                    Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(actionPointInfo.iconID, out sprite);

                    Transform transform = ((Component)this).get_transform().FindLoop(actionPointInfo.labelNullName)?.get_transform() ?? ((Component)this).get_transform();
                    if (pair.Key == EventType.DoorOpen)
                    {
                        toRelease3.Add(new CommandLabel.CommandInfo()
                        {
                            Text             = actionName,
                            Icon             = sprite,
                            IsHold           = false,
                            TargetSpriteInfo = icon.ActionSpriteInfo,
                            Transform        = transform,
                            Event            = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)doorPoint))
                        });
                        if (actionPointInfo.doorOpenType > -1)
                        {
                            this._openType = (DoorPoint.OpenTypeState)actionPointInfo.doorOpenType;
                        }
                    }
                    else if (pair.Key == EventType.DoorClose)
                    {
                        toRelease4.Add(new CommandLabel.CommandInfo()
                        {
                            Text             = actionName,
                            Icon             = sprite,
                            IsHold           = false,
                            TargetSpriteInfo = icon.ActionSpriteInfo,
                            Transform        = transform,
                            Event            = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)doorPoint))
                        });
                        if (actionPointInfo.doorOpenType > -1)
                        {
                            this._openType = (DoorPoint.OpenTypeState)actionPointInfo.doorOpenType;
                        }
                    }
                }
            }
            this._sickOpeningLabels = toRelease3.ToArray();
            this._sickClosingLabels = toRelease4.ToArray();
            ListPool <CommandLabel.CommandInfo> .Release(toRelease3);

            ListPool <CommandLabel.CommandInfo> .Release(toRelease4);
        }
Example #5
0
        public void CreateChicken()
        {
            if (this._farmKind != FarmPoint.FarmKind.ChickenCoop)
            {
                return;
            }
            if (this.ChickenList != null)
            {
                this.ChickenList.RemoveAll((Predicate <PetChicken>)(x => Object.op_Equality((Object)x, (Object)null)));
            }
            else
            {
                if (!Singleton <Game> .IsInstance() || !Singleton <AnimalManager> .IsInstance())
                {
                    return;
                }
                AIProject.SaveData.Environment environment = Singleton <Game> .Instance.Environment;
                if (environment == null)
                {
                    return;
                }
                this.ChickenList = ListPool <PetChicken> .Get();

                Dictionary <int, List <AIProject.SaveData.Environment.ChickenInfo> > chickenTable = environment.ChickenTable;
                if (chickenTable == null)
                {
                    return;
                }
                List <AIProject.SaveData.Environment.ChickenInfo> source1 = (List <AIProject.SaveData.Environment.ChickenInfo>)null;
                if (!chickenTable.TryGetValue(this.RegisterID, out source1) || source1.IsNullOrEmpty <AIProject.SaveData.Environment.ChickenInfo>())
                {
                    if (Singleton <Manager.Map> .IsInstance())
                    {
                        int mapId = Singleton <Manager.Map> .Instance.MapID;
                        int areaIdOnHousingArea = this.AreaIDOnHousingArea;
                        Dictionary <int, Dictionary <int, AIProject.SaveData.AnimalData> > source2;
                        Dictionary <int, AIProject.SaveData.AnimalData> source3;
                        if (!environment.HousingChickenDataTable.TryGetValue(mapId, out source2) || source2.IsNullOrEmpty <int, Dictionary <int, AIProject.SaveData.AnimalData> >() || (!source2.TryGetValue(areaIdOnHousingArea, out source3) || source3.IsNullOrEmpty <int, AIProject.SaveData.AnimalData>()))
                        {
                            return;
                        }
                        int num = source3.Keys.Max();
                        if (source1 == null)
                        {
                            chickenTable[this.RegisterID] = source1 = new List <AIProject.SaveData.Environment.ChickenInfo>();
                        }
                        while (source1.Count <= num)
                        {
                            source1.Add((AIProject.SaveData.Environment.ChickenInfo)null);
                        }
                        for (int index = 0; index < source1.Count; ++index)
                        {
                            source1[index] = (AIProject.SaveData.Environment.ChickenInfo)null;
                        }
                        foreach (KeyValuePair <int, AIProject.SaveData.AnimalData> keyValuePair in source3)
                        {
                            int key = keyValuePair.Key;
                            AIProject.SaveData.AnimalData animalData = keyValuePair.Value;
                            if (animalData == null)
                            {
                                source1[key] = (AIProject.SaveData.Environment.ChickenInfo)null;
                            }
                            else
                            {
                                source1[key] = new AIProject.SaveData.Environment.ChickenInfo()
                                {
                                    name       = animalData.Nickname,
                                    AnimalData = animalData
                                }
                            };
                        }
                    }
                    if (source1.IsNullOrEmpty <AIProject.SaveData.Environment.ChickenInfo>())
                    {
                        return;
                    }
                }
                for (int index = 0; index < source1.Count; ++index)
                {
                    AIProject.SaveData.AnimalData animalData = source1.GetElement <AIProject.SaveData.Environment.ChickenInfo>(index)?.AnimalData;
                    if (animalData != null)
                    {
                        if (!animalData.InitAnimalTypeID || animalData.AnimalTypeID < 0)
                        {
                            animalData.AnimalTypeID     = AIProject.Animal.AnimalData.GetAnimalTypeID(animalData.AnimalType);
                            animalData.InitAnimalTypeID = true;
                        }
                        AnimalBase animalBase = Singleton <AnimalManager> .Instance.CreateBase(animalData.AnimalTypeID, (int)animalData.BreedingType);

                        if (!Object.op_Equality((Object)animalBase, (Object)null))
                        {
                            ((Component)animalBase).get_transform().SetParent(this.AnimalRoot, true);
                            animalData.AnimalID = animalBase.AnimalID;
                            if (animalBase is IPetAnimal petAnimal)
                            {
                                petAnimal.AnimalData = animalData;
                            }
                            PetChicken chicken = animalBase as PetChicken;
                            this.AddChicken(index, chicken);
                            if (Object.op_Inequality((Object)chicken, (Object)null))
                            {
                                chicken.Initialize(this);
                            }
                        }
                    }
                }
            }
        }
Example #6
0
        protected override void Start()
        {
            CommonDefine.CommonIconGroup icon       = Singleton <Resources> .Instance.CommonDefine.Icon;
            DefinePack.MapGroup          mapDefines = Singleton <Resources> .Instance.DefinePack.MapDefines;
            if (Object.op_Equality((Object)this._commandBasePoint, (Object)null))
            {
                this._commandBasePoint = ((Component)this).get_transform().FindLoop(Singleton <Resources> .Instance.DefinePack.MapDefines.CommandTargetName)?.get_transform() ?? ((Component)this).get_transform();
            }
            base.Start();
            this.NavMeshPoints.Add(((Component)this).get_transform());
            List <GameObject> gameObjectList = ListPool <GameObject> .Get();

            ((Component)this).get_transform().FindLoopPrefix(gameObjectList, mapDefines.NavMeshTargetName);
            if (!gameObjectList.IsNullOrEmpty <GameObject>())
            {
                using (List <GameObject> .Enumerator enumerator = gameObjectList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        this.NavMeshPoints.Add(enumerator.Current.get_transform());
                    }
                }
            }
            ListPool <GameObject> .Release(gameObjectList);

            Sprite sprite1;

            Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(Singleton <Resources> .Instance.CommonDefine.Icon.FarmIconID, out sprite1);

            Sprite sprite2;

            Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(Singleton <Resources> .Instance.CommonDefine.Icon.ChickenCoopIconID, out sprite2);

            Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(Singleton <Resources> .Instance.CommonDefine.Icon.WellIconID, out Sprite _);

            Transform transform = ((Component)this).get_transform().FindLoop(mapDefines.FarmPointLabelTargetName)?.get_transform() ?? ((Component)this).get_transform();

            if (this._farmKind == FarmPoint.FarmKind.Plant)
            {
                this._labels = new CommandLabel.CommandInfo[1]
                {
                    new CommandLabel.CommandInfo()
                    {
                        Text             = "畑",
                        Icon             = sprite1,
                        IsHold           = true,
                        TargetSpriteInfo = icon.ActionSpriteInfo,
                        Transform        = transform,
                        Condition        = (Func <PlayerActor, bool>)(x => this._farmKind == FarmPoint.FarmKind.Plant),
                        Event            = (Action)(() =>
                        {
                            MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
                            List <AIProject.SaveData.Environment.PlantInfo> plantInfoList1;
                            if (!Singleton <Game> .Instance.Environment.FarmlandTable.TryGetValue(this._id, out plantInfoList1))
                            {
                                List <AIProject.SaveData.Environment.PlantInfo> plantInfoList2 = new List <AIProject.SaveData.Environment.PlantInfo>();
                                Singleton <Game> .Instance.Environment.FarmlandTable[this._id] = plantInfoList2;
                                plantInfoList1 = plantInfoList2;
                                foreach (FarmSection harvestSection in this._harvestSections)
                                {
                                    plantInfoList1.Add((AIProject.SaveData.Environment.PlantInfo)null);
                                }
                            }
                            MapUIContainer.FarmlandUI.currentPlant = plantInfoList1;
                            MapUIContainer.SetActiveFarmlandUI(true);
                            Singleton <Manager.Map> .Instance.Player.Controller.ChangeState("Harvest");
                        })
                    }
                }
            }
            ;
            else if (this._farmKind == FarmPoint.FarmKind.ChickenCoop)
            {
                this._labels = new CommandLabel.CommandInfo[1]
                {
                    new CommandLabel.CommandInfo()
                    {
                        Text             = "鶏小屋",
                        Icon             = sprite2,
                        IsHold           = true,
                        TargetSpriteInfo = icon.ActionSpriteInfo,
                        Transform        = transform,
                        Condition        = (Func <PlayerActor, bool>)(x => this._farmKind == FarmPoint.FarmKind.ChickenCoop),
                        Event            = (Action)(() =>
                        {
                            PlayerActor playerActor = !Singleton <Manager.Map> .IsInstance() ? (PlayerActor)null : Singleton <Manager.Map> .Instance.Player;
                            if (!Object.op_Inequality((Object)playerActor, (Object)null))
                            {
                                return;
                            }
                            playerActor.CurrentFarmPoint = this;
                            playerActor.PlayerController.ChangeState("ChickenCoopMenu");
                        })
                    }
                }
            }
            ;
            else if (this._farmKind != FarmPoint.FarmKind.Well)
            {
                ;
            }
        }