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を表示する"))
                }
            };
        }
Esempio n. 2
0
        private void StartFadingStream(IConnectableObservable <TimeInterval <float> > stream)
        {
            LoadingPanel loadingPanel = Singleton <Manager.Scene> .Instance.loadingPanel;
            float        startAlpha   = loadingPanel.CanvasGroup.get_alpha();

            Manager.Map instance = Singleton <Manager.Map> .Instance;
            using (IEnumerator <KeyValuePair <int, AgentActor> > enumerator = instance.AgentTable.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <int, AgentActor> current = enumerator.Current;
                    if (current.Value.AgentData.CarryingItem != null && current.Value.Mode != Desire.ActionType.SearchEatSpot && (current.Value.Mode != Desire.ActionType.EndTaskEat && current.Value.Mode != Desire.ActionType.EndTaskEatThere))
                    {
                        current.Value.AgentData.CarryingItem = (StuffItem)null;
                    }
                    current.Value.EnableBehavior();
                    current.Value.BehaviorResources.ChangeMode(current.Value.Mode);
                }
            }
            PlayerActor player = instance.Player;
            string      stateFromCharaCreate = Game.PrevPlayerStateFromCharaCreate;

            if (!stateFromCharaCreate.IsNullOrEmpty())
            {
                player.PlayerController.ChangeState(stateFromCharaCreate);
                player.CurrentDevicePoint = Singleton <Manager.Map> .Instance.PointAgent.DevicePointDic[Game.PrevAccessDeviceID];
            }
            else
            {
                ReadOnlyDictionary <int, AgentActor> agentTable = instance.AgentTable;
                int?           partnerId = player.PlayerData.PartnerID;
                int            num       = !partnerId.HasValue ? -1 : partnerId.Value;
                AgentActor     agentActor;
                ref AgentActor local = ref agentActor;
                if (agentTable.TryGetValue(num, ref local))
                {
                    player.Partner     = (Actor)agentActor;
                    agentActor.Partner = (Actor)player;
                    if (player.PlayerData.IsOnbu)
                    {
                        player.PlayerController.ChangeState("Onbu");
                    }
                    else
                    {
                        agentActor.BehaviorResources.ChangeMode(Desire.ActionType.Date);
                        agentActor.Mode = Desire.ActionType.Date;
                        player.Mode     = Desire.ActionType.Date;
                        player.PlayerController.ChangeState("Normal");
                    }
                }
                else
                {
                    player.PlayerController.ChangeState("Normal");
                }
            }
Esempio n. 3
0
            public bool DisableDistance(Resources res, Manager.Map map, Transform root)
            {
                if (Object.op_Equality((Object)res, (Object)null))
                {
                    return(true);
                }
                Transform transform = ((Component)map.Player.CameraControl.CameraComponent).get_transform();
                float     num1      = Vector3.SqrMagnitude(Vector3.op_Subtraction(root.get_position(), transform.get_position()));
                float     num2      = this.Decay.max + res.SoundPack.EnviroInfo.DisableDistance;

                return((double)(num2 * num2) < (double)num1);
            }
Esempio n. 4
0
            private bool EnableDistance(Resources res, Manager.Map map, Vector3 hitPos)
            {
                if (Object.op_Equality((Object)res, (Object)null))
                {
                    return(false);
                }
                Vector3 position = ((Component)map.Player.CameraControl.CameraComponent).get_transform().get_position();
                float   num1     = Vector3.SqrMagnitude(Vector3.op_Subtraction(hitPos, position));
                float   num2     = this.Decay.max + res.SoundPack.EnviroInfo.EnableDistance;
                float   num3     = num2 * num2;

                return((double)num1 <= (double)num3);
            }
Esempio n. 5
0
        private bool DisableDistance(Resources res, Manager.Map map, Transform root)
        {
            Camera    cameraComponent = Manager.Map.GetCameraComponent();
            Transform transform       = !Object.op_Inequality((Object)cameraComponent, (Object)null) ? (Transform)null : ((Component)cameraComponent).get_transform();

            if (Object.op_Equality((Object)transform, (Object)null))
            {
                return(true);
            }
            float num1 = Vector3.SqrMagnitude(Vector3.op_Subtraction(root.get_position(), transform.get_position()));
            float num2 = (float)this._decay.y + res.SoundPack.EnviroInfo.DisableDistance;

            return((double)(num2 * num2) < (double)num1);
        }
Esempio n. 6
0
            public void Update(
                Weather weather,
                TimeZone timeZone,
                Resources res,
                Manager.Map map,
                Transform root)
            {
                Transform root1 = !Object.op_Equality((Object)this.Root, (Object)null) ? this.Root : root;

                this.IsEnableDistance = !this.IsEnableDistance ? this.EnableDistance(res, map, root1) : !this.DisableDistance(res, map, root1);
                bool playEnable = this.PlayEnable;

                this.PlayEnable = this.CheckPlayEnable(weather, timeZone) && this.IsEnableDistance;
                if (this.IsPlay)
                {
                    bool flag = Object.op_Equality((Object)this.Audio, (Object)null) || !this.IsLoop && !this.Audio.get_isPlaying();
                    if (flag && this.IsLoop)
                    {
                        this.DelayTime = 1f;
                    }
                    if (flag || !this.PlayEnable)
                    {
                        this.Reset();
                    }
                }
                else if (this.PlayEnable)
                {
                    this.ElapsedTime += Time.get_deltaTime();
                    if ((double)this.DelayTime <= (double)this.ElapsedTime)
                    {
                        this.ElapsedTime = 0.0f;
                        this.ResetDelay();
                        this.Play(root1);
                    }
                }
                if (Object.op_Inequality((Object)this.Audio, (Object)null))
                {
                    ((Component)this.Audio).get_transform().set_position(root1.get_position());
                    ((Component)this.Audio).get_transform().set_rotation(root1.get_rotation());
                }
                if (this.PlayEnable || !playEnable)
                {
                    return;
                }
                this.ResetDelay();
                this.ElapsedTime  = 0.0f;
                this.FirstPlaying = true;
            }
Esempio n. 7
0
        private void OnUpdate()
        {
            if (!Singleton <Manager.Map> .IsInstance() || this._playInfos.IsNullOrEmpty <EnvArea3DSE.PlayInfo>())
            {
                return;
            }
            Manager.Map instance = Singleton <Manager.Map> .Instance;
            Resources   res      = !Singleton <Resources> .IsInstance() ? (Resources)null : Singleton <Resources> .Instance;

            EnvironmentSimulator simulator = instance.Simulator;

            foreach (EnvArea3DSE.PlayInfo playInfo in this._playInfos)
            {
                playInfo.Update(simulator.Weather, simulator.TimeZone, res, instance, ((Component)this).get_transform());
            }
        }
Esempio n. 8
0
        private void OnUpdate()
        {
            if (!Singleton <Manager.Map> .IsInstance() || !Singleton <Resources> .IsInstance())
            {
                return;
            }
            Manager.Map instance1        = Singleton <Manager.Map> .Instance;
            Resources   instance2        = Singleton <Resources> .Instance;
            Transform   root             = !Object.op_Inequality((Object)this._playRoot, (Object)null) ? ((Component)this).get_transform() : this._playRoot;
            bool        isEnableDistance = this._isEnableDistance;

            this._isEnableDistance = this.PlayEnabled && (!this._isEnableDistance ? this.EnableDistance(instance2, instance1, root) : !this.DisableDistance(instance2, instance1, root));
            if (this._isPlay)
            {
                bool flag = Object.op_Equality((Object)this._audio, (Object)null) || !this._isLoop && !this._audio.get_isPlaying();
                if (flag && this._isLoop)
                {
                    this._delayTime = 1f;
                }
                if (flag || !this._isEnableDistance)
                {
                    this.SoundReset();
                }
            }
            else if (this._isEnableDistance)
            {
                this._elapsedTime += Time.get_deltaTime();
                if ((double)this._delayTime <= (double)this._elapsedTime)
                {
                    this._elapsedTime = 0.0f;
                    this.ResetDelay();
                    this.SoundPlay(root);
                }
            }
            if (Object.op_Inequality((Object)this._audio, (Object)null))
            {
                ((Component)this._audio).get_transform().SetPositionAndRotation(root.get_position(), root.get_rotation());
            }
            if (this._isEnableDistance || !isEnableDistance)
            {
                return;
            }
            this.ResetDelay();
            this._elapsedTime  = 0.0f;
            this._firstPlaying = true;
        }
Esempio n. 9
0
        public bool CanDelete()
        {
            if (this.SaveData == null || this.SaveData.AnimalData == null || (!Singleton <Manager.Map> .IsInstance() || !Singleton <Resources> .IsInstance()))
            {
                return(true);
            }
            AIProject.SaveData.AnimalData animalData = this.SaveData.AnimalData;
            int itemCategoryId = animalData.ItemCategoryID;
            int itemId         = animalData.ItemID;

            if (Singleton <Resources> .Instance.GameInfo.GetItem(itemCategoryId, itemId) == null)
            {
                return(true);
            }
            Manager.Map instance = Singleton <Manager.Map> .Instance;
            List <ValueTuple <int, List <StuffItem> > > inventoryList = instance.GetInventoryList();

            if (((IReadOnlyList <ValueTuple <int, List <StuffItem> > >)inventoryList).IsNullOrEmpty <ValueTuple <int, List <StuffItem> > >())
            {
                instance.ReturnInventoryList(inventoryList);
                return(true);
            }
            StuffItem stuffItem = new StuffItem(itemCategoryId, itemId, 1);
            bool      flag      = false;

            using (List <ValueTuple <int, List <StuffItem> > > .Enumerator enumerator = inventoryList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ValueTuple <int, List <StuffItem> > current = enumerator.Current;
                    int capacity          = (int)current.Item1;
                    List <StuffItem> self = (List <StuffItem>)current.Item2;
                    int possible          = 0;
                    StuffItemExtensions.CanAddItem((IReadOnlyCollection <StuffItem>)self, capacity, stuffItem, out possible);
                    flag = stuffItem.Count <= possible;
                    if (flag)
                    {
                        self.AddItem(stuffItem);
                        break;
                    }
                }
            }
            return(flag);
        }
Esempio n. 10
0
            public void Update(Weather weather, TimeZone timeZone, Resources res, Manager.Map map)
            {
                Vector3 getHitPoint;
                bool    nearPoint = this.TryGetNearPoint(out getHitPoint, out EnvLineArea3DSE.LineT _);

                this.IsEnableDistance = !this.IsEnableDistance ? nearPoint && this.EnableDistance(res, map, getHitPoint) : nearPoint && !this.DisableDistance(res, map, getHitPoint);
                bool playEnable = this.PlayEnable;

                this.PlayEnable = this.CheckEnableEnvironment(weather, timeZone) && this.IsEnableDistance;
                if (this.IsPlay)
                {
                    bool flag = Object.op_Equality((Object)this.Audio, (Object)null) || !this.IsLoop && !this.Audio.get_isPlaying();
                    if (flag && this.IsLoop)
                    {
                        this.DelayTime = 1f;
                    }
                    if (flag || !this.PlayEnable)
                    {
                        this.Reset();
                    }
                }
                else if (this.PlayEnable)
                {
                    this.ElapsedTime += Time.get_deltaTime();
                    if ((double)this.DelayTime <= (double)this.ElapsedTime)
                    {
                        this.ElapsedTime = 0.0f;
                        this.ResetDelay();
                        this.Play(getHitPoint);
                    }
                }
                if (Object.op_Inequality((Object)this.Audio, (Object)null) && nearPoint)
                {
                    ((Component)this.Audio).get_transform().set_position(getHitPoint);
                }
                if (this.PlayEnable || !playEnable)
                {
                    return;
                }
                this.ResetDelay();
                this.ElapsedTime  = 0.0f;
                this.FirstPlaying = true;
            }
Esempio n. 11
0
        private void LoadMapGroups()
        {
            Manager.Map instance = Singleton <Manager.Map> .Instance;
            instance.MapGroupObjList.Clear();
            Dictionary <int, string> dictionary;

            if (!Singleton <Resources> .Instance.Map.MapGroupNameList.TryGetValue(instance.MapID, out dictionary))
            {
                return;
            }
            foreach (KeyValuePair <int, string> keyValuePair in dictionary)
            {
                GameObject loop = ((Component)this).get_transform().FindLoop(keyValuePair.Value);
                if (!Object.op_Equality((Object)loop, (Object)null))
                {
                    instance.MapGroupObjList[keyValuePair.Key] = loop;
                }
            }
        }
Esempio n. 12
0
        public static void Initialize()
        {
            CheatToolsWindow.OnShown = window =>
            {
                _studioInstance = Studio.Studio.IsInstance() ? Studio.Studio.Instance : null;
                _soundInstance  = Manager.Sound.Instance;
                _sceneInstance  = Scene.Instance;
                _gameMgr        = Game.IsInstance() ? Game.Instance : null;
                _resources      = Resources.Instance;
                _map            = Map.IsInstance() ? Map.Instance : null;
                _hScene         = HSceneFlagCtrl.IsInstance() ? HSceneFlagCtrl.Instance : null;

                _gameTimeText = null;

                _openInInspectorButtons = new[]
                {
                    new KeyValuePair <object, string>(_map != null && _map.AgentTable.Count > 0 ? (Func <object>)(() => _map.AgentTable.Values.Select(x => new ReadonlyCacheEntry(x.CharaName, x))) : null, "Heroine list"),
                    new KeyValuePair <object, string>(Manager.ADV.IsInstance() ? Manager.ADV.Instance : null, "Manager.ADV.Instance"),
                    new KeyValuePair <object, string>(AnimalManager.IsInstance() ? AnimalManager.Instance : null, "Manager.AnimalManager.Instance"),
                    new KeyValuePair <object, string>(_map, "Manager.Map.Instance"),
                    new KeyValuePair <object, string>(Character.IsInstance() ? Character.Instance : null, "Manager.Character.Instance"),
                    new KeyValuePair <object, string>(Config.IsInstance() ? Config.Instance : null, "Manager.Config.Instance"),
                    new KeyValuePair <object, string>(_gameMgr, "Manager.Game.Instance"),
                    new KeyValuePair <object, string>(Manager.Housing.IsInstance() ? Manager.Housing.Instance : null, "Manager.Housing.Instance"),
                    new KeyValuePair <object, string>(_sceneInstance, "Manager.Scene.Instance"),
                    new KeyValuePair <object, string>(_soundInstance, "Manager.Sound.Instance"),
                    new KeyValuePair <object, string>(_studioInstance, "Studio.Instance"),
                    new KeyValuePair <object, string>((Func <object>)EditorUtilities.GetRootGoScanner, "Root Objects")
                };
            };


            CheatToolsWindow.Cheats.Add(new CheatEntry(w => _map != null && _map.Player != null && _map.Player.PlayerData != null, DrawPlayerCheats, "Start the game to see player cheats"));
            CheatToolsWindow.Cheats.Add(new CheatEntry(w => _map != null && _map.Simulator != null, DrawEnviroControls, null));
            CheatToolsWindow.Cheats.Add(new CheatEntry(w => _hScene != null, DrawHSceneCheats, null));
            CheatToolsWindow.Cheats.Add(new CheatEntry(w => _map != null, DrawGirlCheatMenu, null));

            CheatToolsWindow.Cheats.Add(CheatEntry.CreateOpenInInspectorButtons(() => _openInInspectorButtons));
        }
Esempio n. 13
0
        private void LoadTimeRelationObjects()
        {
            if (!Singleton <Manager.Map> .IsInstance() || !Singleton <Resources> .IsInstance())
            {
                return;
            }
            Resources instance1 = Singleton <Resources> .Instance;

            Manager.Map instance2 = Singleton <Manager.Map> .Instance;
            string      str1      = "_EmissionColor";
            Dictionary <int, Dictionary <int, Dictionary <bool, Dictionary <int, ValueTuple <GameObject, Material, float, Color>[]> > > > relationObjectTable = instance2.TimeRelationObjectTable;
            Dictionary <int, Dictionary <int, Dictionary <bool, Dictionary <int, List <ValueTuple <string, float> > > > > > objectStateTable = instance1.Map.TimeRelationObjectStateTable;

            relationObjectTable.Clear();
            if (objectStateTable.IsNullOrEmpty <int, Dictionary <int, Dictionary <bool, Dictionary <int, List <ValueTuple <string, float> > > > > >())
            {
                return;
            }
            using (Dictionary <int, Dictionary <int, Dictionary <bool, Dictionary <int, List <ValueTuple <string, float> > > > > > .Enumerator enumerator1 = objectStateTable.GetEnumerator())
            {
                while (enumerator1.MoveNext())
                {
                    KeyValuePair <int, Dictionary <int, Dictionary <bool, Dictionary <int, List <ValueTuple <string, float> > > > > > current1 = enumerator1.Current;
                    if (!current1.Value.IsNullOrEmpty <int, Dictionary <bool, Dictionary <int, List <ValueTuple <string, float> > > > >())
                    {
                        int key1 = current1.Key;
                        using (Dictionary <int, Dictionary <bool, Dictionary <int, List <ValueTuple <string, float> > > > > .Enumerator enumerator2 = current1.Value.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                KeyValuePair <int, Dictionary <bool, Dictionary <int, List <ValueTuple <string, float> > > > > current2 = enumerator2.Current;
                                if (!current2.Value.IsNullOrEmpty <bool, Dictionary <int, List <ValueTuple <string, float> > > >())
                                {
                                    int key2 = current2.Key;
                                    using (Dictionary <bool, Dictionary <int, List <ValueTuple <string, float> > > > .Enumerator enumerator3 = current2.Value.GetEnumerator())
                                    {
                                        while (enumerator3.MoveNext())
                                        {
                                            KeyValuePair <bool, Dictionary <int, List <ValueTuple <string, float> > > > current3 = enumerator3.Current;
                                            if (!current3.Value.IsNullOrEmpty <int, List <ValueTuple <string, float> > >())
                                            {
                                                bool key3 = current3.Key;
                                                using (Dictionary <int, List <ValueTuple <string, float> > > .Enumerator enumerator4 = current3.Value.GetEnumerator())
                                                {
                                                    while (enumerator4.MoveNext())
                                                    {
                                                        KeyValuePair <int, List <ValueTuple <string, float> > > current4 = enumerator4.Current;
                                                        if (!current4.Value.IsNullOrEmpty <ValueTuple <string, float> >())
                                                        {
                                                            int key4 = current4.Key;
                                                            ValueTuple <GameObject, Material, float, Color>[] valueTupleArray = (ValueTuple <GameObject, Material, float, Color>[])null;
                                                            switch (key2)
                                                            {
                                                            case 0:
                                                                List <GameObject> gameObjectList = ListPool <GameObject> .Get();

                                                                using (List <ValueTuple <string, float> > .Enumerator enumerator5 = current4.Value.GetEnumerator())
                                                                {
                                                                    while (enumerator5.MoveNext())
                                                                    {
                                                                        string str2 = (string)enumerator5.Current.Item1;
                                                                        if (!str2.IsNullOrEmpty())
                                                                        {
                                                                            GameObject loop = ((Component)this).get_transform().FindLoop(str2);
                                                                            if (!Object.op_Equality((Object)loop, (Object)null))
                                                                            {
                                                                                gameObjectList.Add(loop);
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                                if (!gameObjectList.IsNullOrEmpty <GameObject>())
                                                                {
                                                                    valueTupleArray = new ValueTuple <GameObject, Material, float, Color> [gameObjectList.Count];
                                                                    for (int index = 0; index < valueTupleArray.Length; ++index)
                                                                    {
                                                                        valueTupleArray[index] = new ValueTuple <GameObject, Material, float, Color>(gameObjectList[index], (Material)null, 0.0f, Color.get_white());
                                                                    }
                                                                }
                                                                ListPool <GameObject> .Release(gameObjectList);

                                                                break;

                                                            case 1:
                                                                List <ValueTuple <GameObject, Material, float, Color> > valueTupleList = ListPool <ValueTuple <GameObject, Material, float, Color> > .Get();

                                                                using (List <ValueTuple <string, float> > .Enumerator enumerator5 = current4.Value.GetEnumerator())
                                                                {
                                                                    while (enumerator5.MoveNext())
                                                                    {
                                                                        ValueTuple <string, float> current5 = enumerator5.Current;
                                                                        string str2 = (string)current5.Item1;
                                                                        if (!str2.IsNullOrEmpty())
                                                                        {
                                                                            GameObject loop = ((Component)this).get_transform().FindLoop(str2);
                                                                            if (!Object.op_Equality((Object)loop, (Object)null))
                                                                            {
                                                                                Renderer componentInChildren = (Renderer)loop.GetComponentInChildren <Renderer>(true);
                                                                                if (!Object.op_Equality((Object)componentInChildren?.get_material()?.get_shader(), (Object)null))
                                                                                {
                                                                                    Color color = Color.get_white();
                                                                                    if (componentInChildren.get_material().HasProperty(str1))
                                                                                    {
                                                                                        color = componentInChildren.get_material().GetColor(str1);
                                                                                        if (1.0 < color.r)
                                                                                        {
                                                                                            color.r = (__Null)(double)Mathf.Repeat((float)color.r, 1f);
                                                                                        }
                                                                                        if (1.0 < color.g)
                                                                                        {
                                                                                            color.g = (__Null)(double)Mathf.Repeat((float)color.g, 1f);
                                                                                        }
                                                                                        if (1.0 < color.b)
                                                                                        {
                                                                                            color.b = (__Null)(double)Mathf.Repeat((float)color.b, 1f);
                                                                                        }
                                                                                        if (1.0 < color.a)
                                                                                        {
                                                                                            color.a = (__Null)(double)Mathf.Repeat((float)color.a, 1f);
                                                                                        }
                                                                                    }
                                                                                    valueTupleList.Add(new ValueTuple <GameObject, Material, float, Color>(loop, componentInChildren.get_material(), (float)current5.Item2, color));
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                                if (!valueTupleList.IsNullOrEmpty <ValueTuple <GameObject, Material, float, Color> >())
                                                                {
                                                                    valueTupleArray = new ValueTuple <GameObject, Material, float, Color> [valueTupleList.Count];
                                                                    for (int index = 0; index < valueTupleArray.Length; ++index)
                                                                    {
                                                                        valueTupleArray[index] = new ValueTuple <GameObject, Material, float, Color>((GameObject)valueTupleList[index].Item1, (Material)valueTupleList[index].Item2, (float)valueTupleList[index].Item3, (Color)valueTupleList[index].Item4);
                                                                    }
                                                                }
                                                                ListPool <ValueTuple <GameObject, Material, float, Color> > .Release(valueTupleList);

                                                                break;
                                                            }
                                                            if (valueTupleArray == null)
                                                            {
                                                                valueTupleArray = new ValueTuple <GameObject, Material, float, Color> [0];
                                                            }
                                                            Dictionary <int, Dictionary <bool, Dictionary <int, ValueTuple <GameObject, Material, float, Color>[]> > > dictionary1;
                                                            if (!relationObjectTable.TryGetValue(key1, out dictionary1))
                                                            {
                                                                relationObjectTable[key1] = dictionary1 = new Dictionary <int, Dictionary <bool, Dictionary <int, ValueTuple <GameObject, Material, float, Color>[]> > >();
                                                            }
                                                            Dictionary <bool, Dictionary <int, ValueTuple <GameObject, Material, float, Color>[]> > dictionary2;
                                                            if (!dictionary1.TryGetValue(key2, out dictionary2))
                                                            {
                                                                dictionary1[key2] = dictionary2 = new Dictionary <bool, Dictionary <int, ValueTuple <GameObject, Material, float, Color>[]> >();
                                                            }
                                                            Dictionary <int, ValueTuple <GameObject, Material, float, Color>[]> dictionary3;
                                                            if (!dictionary2.TryGetValue(key3, out dictionary3))
                                                            {
                                                                dictionary2[key3] = dictionary3 = new Dictionary <int, ValueTuple <GameObject, Material, float, Color>[]>();
                                                            }
                                                            dictionary3[key4] = valueTupleArray;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            instance2.RefreshActiveTimeRelationObjects();
        }
Esempio n. 14
0
        public bool CanDelete()
        {
            if (this._kind != CraftPoint.CraftKind.Recycling || !Singleton <Manager.Map> .IsInstance() || !Singleton <Game> .IsInstance())
            {
                return(true);
            }
            WorldData worldData = Singleton <Game> .Instance.WorldData;

            AIProject.SaveData.Environment environment = worldData == null ? (AIProject.SaveData.Environment)null : worldData.Environment;
            if (environment == null)
            {
                return(true);
            }
            RecyclingData recyclingData = (RecyclingData)null;

            if (!environment.RecyclingDataTable.TryGetValue(this.RegisterID, out recyclingData) || recyclingData == null)
            {
                return(true);
            }
            recyclingData.DecidedItemList.RemoveAll((Predicate <StuffItem>)(x => x == null || x.Count <= 0));
            recyclingData.CreatedItemList.RemoveAll((Predicate <StuffItem>)(x => x == null || x.Count <= 0));
            if (recyclingData.DecidedItemList.IsNullOrEmpty <StuffItem>() && recyclingData.CreatedItemList.IsNullOrEmpty <StuffItem>())
            {
                return(true);
            }
            List <StuffItem> stuffItemList1 = ListPool <StuffItem> .Get();

            foreach (StuffItem decidedItem in recyclingData.DecidedItemList)
            {
                StuffItem itemInstance = CraftPoint.GetItemInstance();
                CraftPoint.CopyItem(decidedItem, itemInstance);
                stuffItemList1.AddItem(itemInstance);
            }
            foreach (StuffItem createdItem in recyclingData.CreatedItemList)
            {
                StuffItem itemInstance = CraftPoint.GetItemInstance();
                CraftPoint.CopyItem(createdItem, itemInstance);
                stuffItemList1.AddItem(itemInstance);
            }
            Manager.Map instance = Singleton <Manager.Map> .Instance;
            List <ValueTuple <int, List <StuffItem> > > inventoryList  = instance.GetInventoryList();
            List <ValueTuple <int, List <StuffItem> > > valueTupleList = ListPool <ValueTuple <int, List <StuffItem> > > .Get();

            using (List <ValueTuple <int, List <StuffItem> > > .Enumerator enumerator = inventoryList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ValueTuple <int, List <StuffItem> > current = enumerator.Current;
                    int num = (int)current.Item1;
                    List <StuffItem> source         = (List <StuffItem>)current.Item2;
                    List <StuffItem> stuffItemList2 = ListPool <StuffItem> .Get();

                    valueTupleList.Add(new ValueTuple <int, List <StuffItem> >(num, stuffItemList2));
                    if (!source.IsNullOrEmpty <StuffItem>())
                    {
                        foreach (StuffItem from in source)
                        {
                            StuffItem itemInstance = CraftPoint.GetItemInstance();
                            CraftPoint.CopyItem(from, itemInstance);
                            stuffItemList2.Add(itemInstance);
                        }
                    }
                }
            }
            using (List <ValueTuple <int, List <StuffItem> > > .Enumerator enumerator = valueTupleList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ValueTuple <int, List <StuffItem> > current = enumerator.Current;
                    int num = (int)current.Item1;
                    List <StuffItem> self = (List <StuffItem>)current.Item2;
                    for (int index = 0; index < stuffItemList1.Count; ++index)
                    {
                        StuffItem element = stuffItemList1.GetElement <StuffItem>(index);
                        if (element == null || element.Count <= 0)
                        {
                            stuffItemList1.RemoveAt(index);
                            --index;
                        }
                        else
                        {
                            StuffItem itemInstance = CraftPoint.GetItemInstance();
                            CraftPoint.CopyItem(element, itemInstance);
                            int possible = 0;
                            StuffItemExtensions.CanAddItem((IReadOnlyCollection <StuffItem>)self, num, itemInstance, out possible);
                            if (0 < possible)
                            {
                                possible = Mathf.Min(possible, itemInstance.Count);
                                self.AddItem(itemInstance, possible, num);
                            }
                            element.Count -= possible;
                            if (element.Count <= 0)
                            {
                                stuffItemList1.RemoveAt(index);
                                --index;
                            }
                        }
                    }
                }
            }
            stuffItemList1.RemoveAll((Predicate <StuffItem>)(x => x == null || x.Count <= 0));
            bool flag = stuffItemList1.IsNullOrEmpty <StuffItem>();

            if (flag)
            {
                using (List <ValueTuple <int, List <StuffItem> > > .Enumerator enumerator = inventoryList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ValueTuple <int, List <StuffItem> > current = enumerator.Current;
                        int slotMax = (int)current.Item1;
                        List <StuffItem> receiver = (List <StuffItem>)current.Item2;
                        instance.SendItemListToList(slotMax, recyclingData.DecidedItemList, receiver);
                        instance.SendItemListToList(slotMax, recyclingData.CreatedItemList, receiver);
                    }
                }
            }
            using (List <ValueTuple <int, List <StuffItem> > > .Enumerator enumerator = valueTupleList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ValueTuple <int, List <StuffItem> > current = enumerator.Current;
                    if (current.Item2 != null)
                    {
                        foreach (StuffItem stuffItem in (List <StuffItem>)current.Item2)
                        {
                            CraftPoint.ReturnItemInstance(stuffItem);
                        }
                        ListPool <StuffItem> .Release((List <StuffItem>) current.Item2);
                    }
                }
            }
            foreach (StuffItem stuffItem in stuffItemList1)
            {
                CraftPoint.ReturnItemInstance(stuffItem);
            }
            ListPool <StuffItem> .Release(stuffItemList1);

            instance.ReturnInventoryList(inventoryList);
            return(flag);
        }
Esempio n. 15
0
        private static void CreateList(
            AgentActor agent,
            List <ActionPoint> source,
            List <ActionPoint> destination,
            EventType eventType,
            bool isFollow,
            bool isRain)
        {
            Manager.Map            instance           = Singleton <Manager.Map> .Instance;
            int                    searchCount        = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount;
            float                  meshSampleDistance = Singleton <Resources> .Instance.LocomotionProfile.ActionPointNavMeshSampleDistance;
            Dictionary <int, bool> toRelease          = DictionaryPool <int, bool> .Get();

            foreach (ActionPoint actionPoint1 in source)
            {
                if (!Object.op_Equality((Object)actionPoint1, (Object)null) && !Object.op_Equality((Object)actionPoint1.OwnerArea, (Object)null) && (actionPoint1.IsNeutralCommand && !actionPoint1.IsReserved(agent)))
                {
                    List <ActionPoint> connectedActionPoints = actionPoint1.ConnectedActionPoints;
                    if (!connectedActionPoints.IsNullOrEmpty <ActionPoint>())
                    {
                        bool flag = false;
                        foreach (ActionPoint actionPoint2 in connectedActionPoints)
                        {
                            if (!Object.op_Equality((Object)actionPoint2, (Object)null) && (!actionPoint2.IsNeutralCommand || actionPoint2.IsReserved(agent)))
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (flag)
                        {
                            continue;
                        }
                    }
                    if (!isRain || actionPoint1.AreaType == MapArea.AreaType.Indoor)
                    {
                        MapArea ownerArea = actionPoint1.OwnerArea;
                        bool    flag1;
                        if (!toRelease.TryGetValue(ownerArea.AreaID, out flag1))
                        {
                            toRelease[ownerArea.AreaID] = flag1 = Singleton <Manager.Map> .Instance.CheckAvailableMapArea(ownerArea.AreaID);
                        }
                        if (flag1 && (!isFollow ? actionPoint1.AgentEventType : actionPoint1.AgentDateEventType).Contains(eventType))
                        {
                            switch (eventType)
                            {
                            case EventType.Eat:
                                StuffItem       carryingItem     = agent.AgentData.CarryingItem;
                                AgentProfile    agentProfile     = Singleton <Resources> .Instance.AgentProfile;
                                ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems;
                                bool            flag2            = false;
                                foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems)
                                {
                                    if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID)
                                    {
                                        flag2 = true;
                                        break;
                                    }
                                }
                                ActionPointInfo outInfo;
                                if (flag2)
                                {
                                    PoseKeyPair eatDeskId1 = agentProfile.PoseIDTable.EatDeskID;
                                    PoseKeyPair eatDeskId2 = agentProfile.PoseIDTable.EatDeskID;
                                    if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId1.poseID, out outInfo) || actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId2.poseID, out outInfo))
                                    {
                                        break;
                                    }
                                    continue;
                                }
                                PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID;
                                if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out outInfo))
                                {
                                    break;
                                }
                                continue;

                            case EventType.Search:
                                SearchActionPoint searchActionPoint = actionPoint1 as SearchActionPoint;
                                if (Object.op_Inequality((Object)searchActionPoint, (Object)null))
                                {
                                    int registerId = searchActionPoint.RegisterID;
                                    Dictionary <int, AIProject.SaveData.Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable;
                                    AIProject.SaveData.Environment.SearchActionInfo searchActionInfo1;
                                    if (!searchActionLockTable.TryGetValue(registerId, out searchActionInfo1))
                                    {
                                        AIProject.SaveData.Environment.SearchActionInfo searchActionInfo2 = new AIProject.SaveData.Environment.SearchActionInfo();
                                        searchActionLockTable[registerId] = searchActionInfo2;
                                        searchActionInfo1 = searchActionInfo2;
                                    }
                                    if (searchActionInfo1.Count < searchCount)
                                    {
                                        int       tableId  = searchActionPoint.TableID;
                                        StuffItem itemInfo = agent.AgentData.EquipedSearchItem(tableId);
                                        if (agent.SearchAreaID == 0)
                                        {
                                            if (tableId != 0 && tableId != 1 && tableId != 2 || !searchActionPoint.CanSearch(EventType.Search, itemInfo))
                                            {
                                                continue;
                                            }
                                            break;
                                        }
                                        if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo))
                                        {
                                            continue;
                                        }
                                        break;
                                    }
                                    continue;
                                }
                                break;

                            case EventType.Warp:
                                WarpPoint warpPoint = actionPoint1 as WarpPoint;
                                Dictionary <int, List <WarpPoint> > dictionary;
                                List <WarpPoint> warpPointList;
                                if (!Object.op_Inequality((Object)warpPoint, (Object)null) || !Singleton <Manager.Map> .Instance.WarpPointDic.TryGetValue(ownerArea.ChunkID, out dictionary) || (!dictionary.TryGetValue(warpPoint.TableID, out warpPointList) || warpPointList.Count < 2))
                                {
                                    continue;
                                }
                                break;
                            }
                            if (SetDesiredAction._navMeshPath == null)
                            {
                                SetDesiredAction._navMeshPath = new NavMeshPath();
                            }
                            NavMeshHit navMeshHit;
                            if (agent.NavMeshAgent.CalculatePath(actionPoint1.LocatedPosition, SetDesiredAction._navMeshPath) && SetDesiredAction._navMeshPath.get_status() == null && NavMesh.SamplePosition(actionPoint1.LocatedPosition, ref navMeshHit, meshSampleDistance, agent.NavMeshAgent.get_areaMask()))
                            {
                                destination.Add(actionPoint1);
                            }
                        }
                    }
                }
            }
            DictionaryPool <int, bool> .Release(toRelease);
        }