Exemplo n.º 1
0
        internal static void LogError(Type source, string text)
        {
            string prefix = $"[{Name}]";

            Debug.LogError($"{prefix}\n{text}");

            if (NotifyCrash.Value && MapUIContainer.IsInstance())
            {
                MapUIContainer.AddNotify($"{prefix} '{source.Name}' crashed! Disabling then enabling will reload it.");
            }
        }
Exemplo n.º 2
0
 private void OnEndSet(PlayerActor player)
 {
     if (this.getAnimalFlag)
     {
         if (this.getIteminfo != null && this.addItem != null)
         {
             MapUIContainer.AddSystemItemLog(this.getIteminfo, this.addItem.Count, true);
         }
         else
         {
             MapUIContainer.AddNotify(MapUIContainer.ItemGetEmptyText);
         }
     }
     player.ClearItems();
     player.Animal = (AnimalBase)null;
     MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.InvokeAcception);
     player.PlayerController.ChangeState("Normal");
 }
Exemplo n.º 3
0
        protected override void EnterDepop()
        {
            this.AutoChangeAnimation = false;
            StuffItemInfo _itemInfo = this.ItemInfo;
            StuffItem     _addItem  = (StuffItem)null;

            if (_itemInfo != null)
            {
                _addItem = new StuffItem(_itemInfo.CategoryID, _itemInfo.ID, 1);
            }
            PlayerActor playerActor = !Singleton <Manager.Map> .IsInstance() ? (PlayerActor)null : Singleton <Manager.Map> .Instance.Player;

            if ((!Object.op_Inequality((Object)playerActor, (Object)null) ? (List <StuffItem>)null : playerActor.PlayerData?.ItemList) != null && _addItem != null)
            {
                playerActor.PlayerData.ItemList.AddItem(_addItem);
            }
            if (Singleton <Resources> .IsInstance())
            {
                AnimalDefinePack animalDefinePack = Singleton <Resources> .Instance.AnimalDefinePack;
                if (Object.op_Inequality((Object)animalDefinePack, (Object)null))
                {
                    AudioSource audioSource = this.Play3DSound(animalDefinePack.SoundID.MechaStartup);
                    if (Object.op_Inequality((Object)audioSource, (Object)null))
                    {
                        audioSource.Stop();
                        ((Component)audioSource).get_transform().SetPositionAndRotation(this.Position, this.Rotation);
                        audioSource.Play();
                    }
                }
            }
            this.PlayInAnim(AnimationCategoryID.Etc, 1, (System.Action)(() =>
            {
                this.AutoChangeAnimation = true;
                if (_itemInfo != null && _addItem != null)
                {
                    MapUIContainer.AddSystemItemLog(_itemInfo, _addItem.Count, true);
                }
                else
                {
                    MapUIContainer.AddNotify(MapUIContainer.ItemGetEmptyText);
                }
                this.SetState(AnimalState.Destroyed, (System.Action)null);
            }));
        }
Exemplo n.º 4
0
            static void WarningCheck(string key, int threshold, ref bool flag)
            {
                float stat = playerController[key];

                if (flag)
                {
                    if (stat > threshold)
                    {
                        flag = false;
                    }
                }
                else if (stat <= threshold)
                {
                    flag = true;
                    string preposition = stat < threshold ? "below" : "at";

                    MapUIContainer.AddNotify($"Your {key} is {preposition} {threshold}%!");
                }
            }
Exemplo n.º 5
0
            static void WarningCheck(LifeStatsController controller, int threshold)
            {
                float stat = controller["health"];

                if (agentWarn.Contains(controller))
                {
                    if (stat > threshold)
                    {
                        agentWarn.Remove(controller);
                    }
                }
                else if (stat <= threshold)
                {
                    agentWarn.Add(controller);

                    string name        = controller.agent.CharaName;
                    string preposition = stat < threshold ? "below" : "at";

                    MapUIContainer.AddNotify($"{name}'s health is {preposition} {threshold}%!");
                }
            }
Exemplo n.º 6
0
        protected override void InitializeCommandLabels()
        {
            if (!((IReadOnlyList <CommandLabel.CommandInfo>) this.getLabels).IsNullOrEmpty <CommandLabel.CommandInfo>())
            {
                return;
            }
            CommonDefine commonDefine = !Singleton <Resources> .IsInstance() ? (CommonDefine)null : Singleton <Resources> .Instance.CommonDefine;

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

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

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

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

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

            System.Type type = ((object)currentPoint).GetType();
            if (Singleton <Game> .IsInstance() && ((object)player.CurrentPoint).GetType() == typeof(SearchActionPoint))
            {
                Dictionary <int, AIProject.SaveData.Environment.SearchActionInfo> searchActionLockTable = Singleton <Game> .Instance.Environment.SearchActionLockTable;
                AIProject.SaveData.Environment.SearchActionInfo searchActionInfo;
                if (!searchActionLockTable.TryGetValue(player.CurrentPoint.RegisterID, out searchActionInfo))
                {
                    searchActionInfo = new AIProject.SaveData.Environment.SearchActionInfo();
                }
                ++searchActionInfo.Count;
                searchActionLockTable[player.CurrentPoint.RegisterID] = searchActionInfo;
            }
            Dictionary <int, ItemTableElement> itemTableInArea = Singleton <Resources> .Instance.GameInfo.GetItemTableInArea(currentPoint.IDList.IsNullOrEmpty <int>()?currentPoint.ID : currentPoint.IDList.GetElement <int>(0));

            if (itemTableInArea != null)
            {
                ;
            }
            Actor.SearchInfo searchInfo = player.RandomAddItem(itemTableInArea, true);
            if (type == typeof(OnceSearchActionPoint))
            {
                OnceSearchActionPoint searchActionPoint = currentPoint as OnceSearchActionPoint;
                if (searchActionPoint.HaveMapItems)
                {
                    Manager.Map.FadeStart(-1f);
                }
                searchActionPoint.SetAvailable(false);
            }
            else if (type == typeof(DropSearchActionPoint))
            {
                DropSearchActionPoint searchActionPoint = currentPoint as DropSearchActionPoint;
                if (searchActionPoint.HaveMapItems)
                {
                    Manager.Map.FadeStart(-1f);
                }
                searchActionPoint.SetCoolTime();
            }
            if (searchInfo.IsSuccess)
            {
                foreach (Actor.ItemSearchInfo itemSearchInfo in searchInfo.ItemList)
                {
                    StuffItem stuffItem = new StuffItem(itemSearchInfo.categoryID, itemSearchInfo.id, itemSearchInfo.count);
                    player.PlayerData.ItemList.AddItem(stuffItem);
                    MapUIContainer.AddSystemItemLog(Singleton <Resources> .Instance.GameInfo.GetItem(itemSearchInfo.categoryID, itemSearchInfo.id), itemSearchInfo.count, true);
                }
                player.Controller.ChangeState("Normal");
            }
            else
            {
                MapUIContainer.AddNotify(MapUIContainer.ItemGetEmptyText);
                player.Controller.ChangeState("Normal");
            }
            AgentActor agentPartner = player.AgentPartner;

            if (Object.op_Equality((Object)agentPartner.CurrentPoint, (Object)null))
            {
                agentPartner.BehaviorResources.ChangeMode(Desire.ActionType.Ovation);
            }
            else
            {
                if (!player.OldEnabledHoldingHand)
                {
                    return;
                }
                ((Behaviour)player.HandsHolder).set_enabled(true);
                player.OldEnabledHoldingHand = false;
            }
        }
Exemplo n.º 9
0
            private static void UpdateAgent(LifeStatsController controller, float hourDelta)
            {
                if (AgentDeath.Value == DeathType.None)
                {
                    return;
                }

                if (controller["health"] > 0)
                {
                    bool healthLoss = false;

                    if (controller.agent.StateType == State.Type.Collapse)
                    {
                        controller["health"] -= AgentHealthLoss.Value * hourDelta;
                        healthLoss            = true;
                    }

                    if (controller.agent.AgentData.StatsTable[(int)AIProject.Definitions.Status.Type.Hunger] <= AgentLowFood.Value)
                    {
                        controller["health"] -= AgentHealthLossHunger.Value * hourDelta;
                        healthLoss            = true;
                    }

                    var thirstLevel = 100 - controller.agent.AgentData.DesireTable[15];
                    controller["water"] -= 5.357f * hourDelta;
                    if (thirstLevel > 35 && controller["water"] < thirstLevel)
                    {
                        controller["water"] = thirstLevel;
                    }

                    if (controller["water"] <= AgentLowWater.Value)
                    {
                        controller["health"] -= AgentHealthLossThirst.Value * hourDelta;
                        healthLoss            = true;
                    }

                    switch (controller.agent.AgentData.SickState.ID)
                    {
                    case AIProject.Definitions.Sickness.ColdID: controller["health"] -= AgentHealthLossCold.Value * hourDelta; healthLoss = true; break;

                    case AIProject.Definitions.Sickness.HeatStrokeID: controller["health"] -= AgentHealthLossHeat.Value * hourDelta; healthLoss = true; break;

                    case AIProject.Definitions.Sickness.HurtID: controller["health"] -= AgentHealthLossHurt.Value * hourDelta; healthLoss = true; break;

                    case AIProject.Definitions.Sickness.StomachacheID: controller.agent.AgentData.StatsTable[(int)AIProject.Definitions.Status.Type.Hunger] -= AgentFoodLossStomachache.Value * hourDelta; break;

                    case AIProject.Definitions.Sickness.OverworkID: controller.agent.AgentData.StatsTable[(int)AIProject.Definitions.Status.Type.Physical] -= AgentStaminaLossOverwork.Value * hourDelta; break;
                    }

                    if (!healthLoss)
                    {
                        if ((controller.agent.StateType == State.Type.Sleep || controller.agent.StateType == State.Type.Immobility))
                        {
                            controller["health"] += AgentHealthRate.Value * hourDelta * 3;
                        }
                        else
                        {
                            controller["health"] += AgentHealthRate.Value * hourDelta;
                        }
                    }

                    if (controller["health"] == 0)
                    {
                        if (AgentDeath.Value == DeathType.PermaDeath)
                        {
                            TryDelete(controller.agent.ChaControl);
                        }

                        if (AgentDeath.Value == DeathType.Incapacitated)
                        {
                            MapUIContainer.AddNotify($"{controller.agent.CharaName} is incapacitated.");
                        }
                        else
                        {
                            MapUIContainer.AddNotify($"{controller.agent.CharaName} died.");
                        }
                    }
                }
                else if (AgentDeath.Value == DeathType.Incapacitated && controller.agent.StateType == State.Type.Immobility)
                {
                    controller["revive"] += 100f * hourDelta / 24f;

                    if (controller["revive"] >= 100)
                    {
                        controller["water", "stamina", "health"] = 100f;
                        controller["revive"] = 0;

                        if (AgentRevivePenalty.Value == RevivePenalty.StatReset)
                        {
                            ResetAgentStats(controller);
                        }
                        else if (AgentRevivePenalty.Value == RevivePenalty.StatLoss)
                        {
                            PenalizeAgentStats(controller);
                        }

                        MapUIContainer.AddNotify($"{controller.agent.CharaName} has been revived.");
                    }
                }
            }
Exemplo n.º 10
0
        public static void Update()
        {
            if (!HSceneManager.IsInstance())
            {
                return;
            }

            if (!HSceneManager.isHScene)
            {
                if (lstAnimInfo != null)
                {
                    lstAnimInfo = null;
                }

                return;
            }

            int category = -1;

            if (CaressKey.Value.IsDown())
            {
                category = 0;
            }
            else if (ServiceKey.Value.IsDown())
            {
                category = 1;
            }
            else if (IntercourseKey.Value.IsDown())
            {
                category = 2;
            }
            else if (SpecialKey.Value.IsDown())
            {
                category = 3;
            }
            else if (LesbianKey.Value.IsDown())
            {
                category = 4;
            }
            else if (GroupKey.Value.IsDown())
            {
                category = 5;
            }

            if (category != -1)
            {
                if (HSceneFlagCtrl.Instance.selectAnimationListInfo == null)
                {
                    if (lstAnimInfo == null)
                    {
                        GenerateList();
                    }

                    if (lstAnimInfo != null && category < lstAnimInfo.Length)
                    {
                        List <HScene.AnimationListInfo> list = lstAnimInfo[category];

                        if (list != null && list.Count > 0)
                        {
                            HScene.AnimationListInfo next = list[UnityEngine.Random.Range(0, list.Count)];
                            HSceneFlagCtrl.Instance.selectAnimationListInfo = next;

                            MapUIContainer.AddNotify($"Next Animation: {next.nameAnimation}");
                        }
                        else
                        {
                            MapUIContainer.AddNotify("No animations available for this category.");
                        }
                    }
                    else
                    {
                        MapUIContainer.AddNotify("This category is not available during this scene.");
                    }
                }
                else
                {
                    MapUIContainer.AddNotify("Next animation is already being loaded.");
                }
            }
        }
Exemplo n.º 11
0
        private void Elapsed(PlayerActor player)
        {
            ActionPoint currentPoint = player.CurrentPoint;

            System.Type type = ((object)currentPoint).GetType();
            if (Singleton <Game> .IsInstance() && type == typeof(SearchActionPoint))
            {
                Dictionary <int, AIProject.SaveData.Environment.SearchActionInfo> searchActionLockTable = Singleton <Game> .Instance.Environment.SearchActionLockTable;
                AIProject.SaveData.Environment.SearchActionInfo searchActionInfo;
                if (!searchActionLockTable.TryGetValue(currentPoint.RegisterID, out searchActionInfo))
                {
                    searchActionInfo = new AIProject.SaveData.Environment.SearchActionInfo();
                }
                ++searchActionInfo.Count;
                searchActionLockTable[currentPoint.RegisterID] = searchActionInfo;
            }
            Actor.SearchInfo searchInfo = new Actor.SearchInfo()
            {
                IsSuccess = false
            };
            if (currentPoint is SearchActionPoint)
            {
                SearchActionPoint searchActionPoint = currentPoint as SearchActionPoint;
                Dictionary <int, ItemTableElement> itemTableInArea = Singleton <Resources> .Instance.GameInfo.GetItemTableInArea(searchActionPoint.IDList.IsNullOrEmpty <int>()?searchActionPoint.ID : searchActionPoint.IDList.GetElement <int>(0));

                searchInfo = player.RandomAddItem(itemTableInArea, true);
            }
            else if (currentPoint is TutorialSearchActionPoint)
            {
                searchInfo = (currentPoint as TutorialSearchActionPoint).GetSearchInfo();
            }
            if (type == typeof(OnceSearchActionPoint))
            {
                OnceSearchActionPoint searchActionPoint = currentPoint as OnceSearchActionPoint;
                if (searchActionPoint.HaveMapItems)
                {
                    Manager.Map.FadeStart(-1f);
                }
                searchActionPoint.SetAvailable(false);
            }
            else if (type == typeof(DropSearchActionPoint))
            {
                DropSearchActionPoint searchActionPoint = currentPoint as DropSearchActionPoint;
                if (searchActionPoint.HaveMapItems)
                {
                    Manager.Map.FadeStart(-1f);
                }
                searchActionPoint.SetCoolTime();
            }
            if (searchInfo.IsSuccess)
            {
                foreach (Actor.ItemSearchInfo itemSearchInfo in searchInfo.ItemList)
                {
                    StuffItem stuffItem = new StuffItem(itemSearchInfo.categoryID, itemSearchInfo.id, itemSearchInfo.count);
                    if (player.PlayerData.ItemList.Count < player.PlayerData.InventorySlotMax)
                    {
                        player.PlayerData.ItemList.AddItem(stuffItem, stuffItem.Count, player.PlayerData.InventorySlotMax);
                    }
                    MapUIContainer.AddSystemItemLog(Singleton <Resources> .Instance.GameInfo.GetItem(itemSearchInfo.categoryID, itemSearchInfo.id), itemSearchInfo.count, true);
                }
                player.Controller.ChangeState("Normal");
            }
            else
            {
                MapUIContainer.AddNotify(MapUIContainer.ItemGetEmptyText);
                player.Controller.ChangeState("Normal");
            }
        }