private void SetActiveControl(bool isActive)
        {
            Input       instance = Singleton <Input> .Instance;
            IEnumerator coroutine;

            if (isActive)
            {
                PlayerActor playerActor = !Singleton <Manager.Map> .IsInstance() ? (PlayerActor)null : Singleton <Manager.Map> .Instance.Player;

                if (Object.op_Inequality((Object)playerActor, (Object)null))
                {
                    this._currentFarmPoint = playerActor.CurrentFarmPoint;
                }
                Time.set_timeScale(0.0f);
                Singleton <Manager.Map> .Instance.Player.SetScheduledInteractionState(false);

                Singleton <Manager.Map> .Instance.Player.ReleaseInteraction();

                this._prevFocusLevel  = instance.FocusLevel;
                instance.FocusLevel   = 0;
                instance.MenuElements = this.MenuUIList;
                coroutine             = this.DoOpen();
            }
            else
            {
                instance.ClearMenuElements();
                instance.FocusLevel = this._prevFocusLevel;
                coroutine           = this.DoClose();
            }
            if (this._fadeDisposable != null)
            {
                this._fadeDisposable.Dispose();
            }
            this._fadeDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)Observable.FromCoroutine((Func <IEnumerator>)(() => coroutine), false), (Action <M0>)(_ => {}), (Action <Exception>)(ex => Debug.LogException(ex)));
        }
        protected override void OnAwake(PlayerActor player)
        {
            this._currentFarmPoint = player.CurrentFarmPoint;
            if (Object.op_Equality((Object)this._currentFarmPoint, (Object)null))
            {
                player.PlayerController.ChangeState("Normal");
            }
            else
            {
                this._input = Singleton <Input> .Instance;
                Input.ValidType state = this._input.State;
                this._input.ReserveState(Input.ValidType.UI);
                this._input.SetupState();
                this._input.ReserveState(state);
                MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
                MapUIContainer.SetVisibleHUD(false);
                int registerId = this._currentFarmPoint.RegisterID;
                List <AIProject.SaveData.Environment.ChickenInfo> chickenInfoList1 = (List <AIProject.SaveData.Environment.ChickenInfo>)null;
                Dictionary <int, List <AIProject.SaveData.Environment.ChickenInfo> > dictionary = !Singleton <Game> .IsInstance() ? (Dictionary <int, List <AIProject.SaveData.Environment.ChickenInfo> >)null : Singleton <Game> .Instance.Environment?.ChickenTable;

                if (dictionary != null && (!dictionary.TryGetValue(registerId, out chickenInfoList1) || chickenInfoList1 == null))
                {
                    List <AIProject.SaveData.Environment.ChickenInfo> chickenInfoList2 = new List <AIProject.SaveData.Environment.ChickenInfo>();
                    dictionary[registerId] = chickenInfoList2;
                    chickenInfoList1       = chickenInfoList2;
                }
                if (chickenInfoList1 == null)
                {
                    chickenInfoList1 = new List <AIProject.SaveData.Environment.ChickenInfo>();
                }
                MapUIContainer.ChickenCoopUI.currentChickens = chickenInfoList1;
                MapUIContainer.ChickenCoopUI.ClosedEvent     = (Action)(() => MapUIContainer.CommandList.Visibled = true);
                MapUIContainer.RefreshCommands(0, player.ChickenCoopCommandInfos);
                MapUIContainer.CommandList.CancelEvent = (Action)(() =>
                {
                    MapUIContainer.SetActiveCommandList(false);
                    player.PlayerController.ChangeState("Normal");
                });
                MapUIContainer.SetActiveCommandList(true, "鶏小屋");
            }
        }
        public void Initialize(FarmPoint farmPoint)
        {
            this.Clear();
            FarmPoint farmPoint1 = farmPoint;

            this.FarmPoint = farmPoint1;
            if (Object.op_Equality((Object)farmPoint1, (Object)null))
            {
                this.SetState(AnimalState.Destroyed, (Action)null);
            }
            else
            {
                this._restrictedPointList = this.FarmPoint.ChickenWaypointList;
                List <Waypoint> toRelease = ListPool <Waypoint> .Get();

                if (!this._restrictedPointList.IsNullOrEmpty <Waypoint>())
                {
                    foreach (Waypoint restrictedPoint in (IEnumerable <Waypoint>) this._restrictedPointList)
                    {
                        if (Object.op_Inequality((Object)restrictedPoint, (Object)null) && restrictedPoint.Available((INavMeshActor)this))
                        {
                            toRelease.Add(restrictedPoint);
                        }
                    }
                }
                while (!((IReadOnlyList <Waypoint>)toRelease).IsNullOrEmpty <Waypoint>())
                {
                    int      index    = Random.Range(0, toRelease.Count);
                    Waypoint waypoint = toRelease[index];
                    toRelease.RemoveAt(index);
                    if (waypoint.Available((INavMeshActor)this))
                    {
                        this._destination = waypoint;
                        break;
                    }
                }
                ListPool <Waypoint> .Release(toRelease);

                Dictionary <int, AnimalModelInfo> source;
                if (Singleton <Manager.Resources> .Instance.AnimalTable.ModelInfoTable.TryGetValue(this.AnimalData.AnimalTypeID, out source) && !((IReadOnlyDictionary <int, AnimalModelInfo>)source).IsNullOrEmpty <int, AnimalModelInfo>())
                {
                    KeyValuePair <int, AnimalModelInfo> keyValuePair = source.Rand <int, AnimalModelInfo>();
                    this.AnimalData.ModelID = keyValuePair.Key;
                    this.SetModelInfo(keyValuePair.Value);
                }
                this.LoadBody();
                this.SetStateData();
                if (Object.op_Equality((Object)this._nicknameRoot, (Object)null))
                {
                    Transform transform = !Object.op_Inequality((Object)this.bodyObject, (Object)null) ? ((Component)this).get_transform() : this.bodyObject.get_transform();
                    this._nicknameRoot = new GameObject("Nickname Root").get_transform();
                    this._nicknameRoot.SetParent(transform, false);
                    this._nicknameRoot.set_localPosition(new Vector3(0.0f, this.NicknameHeightOffset, 0.0f));
                }
                bool flag = false;
                this.MarkerEnabled = flag;
                this.BodyEnabled   = flag;
                ((Behaviour)this.Agent).set_enabled(false);
                this._originPriority  = Singleton <Manager.Resources> .Instance.AnimalDefinePack.AgentInfo.GroundAnimalStartPriority;
                this._originPriority += this.ChickenIndex;
                this.Agent.set_avoidancePriority(this._originPriority);
                if (Object.op_Inequality((Object)this._destination, (Object)null))
                {
                    this._destination.Reserver = (INavMeshActor)this;
                    this.Position = ((Component)this._destination).get_transform().get_position();
                    this.Rotation = Quaternion.Euler(0.0f, Random.Range(0.0f, 360f), 0.0f);
                }
                this.SetState(AnimalState.Start, (Action)null);
            }
        }