示例#1
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;
            }
        }
示例#2
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();
                    })
                }
            };
        }
示例#3
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");
            }
        }