Beispiel #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;
            }
        }
Beispiel #2
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");
            }
        }