示例#1
0
        void Prompt()
        {
            selfTriggerController = parent.GetComponentInChildren <TriggerController>();

            valueMonitorPool.Clear();
            valueMonitorPool.AddMonitor(() =>
            {
                otherTriggerController = selfTriggerController.GetFirstKeepingTriggerController();

                if (otherTriggerController != null)
                {
                    DoorController doorController               = otherTriggerController.ITriggerDelegate as DoorController;
                    NpcController npcController                 = otherTriggerController.ITriggerDelegate as NpcController;
                    TreasureBoxController treasureBox           = otherTriggerController.ITriggerDelegate as TreasureBoxController;
                    JoystickController joystickController       = otherTriggerController.ITriggerDelegate as JoystickController;
                    DropItemController dropItemController       = otherTriggerController.ITriggerDelegate as DropItemController;
                    MagicPortalController magicPortalController =
                        otherTriggerController.ITriggerDelegate as MagicPortalController;

                    if (doorController != null)
                    {
                        if (doorController.IsClosed())
                        {
                            return(0);
                        }
                        else
                        {
                            return(1);
                        }
                    }
                    else if (npcController != null)
                    {
                        return(2);
                    }
                    else if (treasureBox != null)
                    {
                        if (treasureBox.IsOpened())
                        {
                            return(3);
                        }
                        else
                        {
                            return(4);
                        }
                    }
                    else if (joystickController != null)
                    {
                        return(5);
                    }
                    else if (dropItemController != null)
                    {
                        return(6);
                    }
                    else if (magicPortalController != null)
                    {
                        return(7);
                    }
                }
                return(-1);
            }, (int from, int to) =>
            {
                if (otherTriggerController != null)
                {
                    GameObject interactObject = otherTriggerController.ITriggerDelegate.GetGameObject();
                    if (interactObject != null)
                    {
                        DoorController doorController               = interactObject.GetComponent <DoorController>();
                        NpcController npcController                 = interactObject.GetComponent <NpcController>();
                        TreasureBoxController treasureBox           = interactObject.GetComponent <TreasureBoxController>();
                        JoystickController joystickController       = interactObject.GetComponent <JoystickController>();
                        DropItemController dropItemController       = interactObject.GetComponent <DropItemController>();
                        MagicPortalController magicPortalController = interactObject.GetComponent <MagicPortalController>();

                        if (doorController != null)
                        {
                            if (doorController.IsClosed())
                            {
                                ShowPrompt("ui://UI/key");
                            }
                            else
                            {
                                HidePrompt();
                            }
                        }
                        else if (npcController != null)
                        {
                            ShowPrompt("ui://UI/talkmark");
                        }
                        else if (treasureBox != null)
                        {
                            if (treasureBox.IsOpened())
                            {
                                HidePrompt();
                            }
                            else
                            {
                                ShowPrompt("ui://UI/Exclamatory mark");
                            }
                        }
                        else if (joystickController)
                        {
                            ShowPrompt("ui://UI/key");
                        }
                        else if (dropItemController != null)
                        {
                            if (dropItemController.ItemData.pickUpMethod == PickUpMethod.Interact)
                            {
                                ShowPrompt("ui://UI/Exclamatory mark");
                            }
                        }
                        else if (magicPortalController != null)
                        {
                            ShowPrompt("ui://UI/Exclamatory mark");
                        }
                        else
                        {
                            HidePrompt();
                        }
                    }
                }
                else
                {
                    HidePrompt();
                }
            });
        }
示例#2
0
 private void showdropitem()
 {
     valueMonitorPool.AddMonitor((Func <TriggerController>)(() =>
     {
         GameObject player = GameObject.Find("Player1");
         TriggerController selfTriggerController = player.GetComponentInChildren <TriggerController>();
         otherTriggerController = selfTriggerController.GetFirstKeepingTriggerController();
         return(otherTriggerController);
     }), (TriggerController from, TriggerController to) =>
     {
         if (Typedown)
         {
             if (otherTriggerController != null)
             {
                 GameObject interactObject = otherTriggerController.ITriggerDelegate.GetGameObject();
                 if (interactObject != null)
                 {
                     DropItemController dropItemController = interactObject.GetComponent <DropItemController>();
                     DoorController doorController         = interactObject.GetComponent <DoorController>();
                     if (dropItemController != null)
                     {
                         var itemData = ItemManager.Instance.getItemDataById <ItemData>(dropItemController.ItemId);
                         if (itemData != null)
                         {
                             GameObject player             = GameObject.Find("Player1");
                             RoleController roleController = player.GetComponent <RoleController>();
                             if (itemData is WeaponData)
                             {
                                 AttributeShow <WeaponData>(itemData as EquipData);
                                 ShowRoleInfodown();
                             }
                             else if (itemData is ArmorData)
                             {
                                 AttributeShow <ArmorData>(itemData as EquipData);
                                 ShowRoleInfodown();
                             }
                             else if (itemData is DecorationData)//现阶段物品掉落使用
                             {
                                 DecorationData RoleDecorationData;
                                 AttributeShow <DecorationData>(itemData as EquipData);
                                 ShowRoleInfodown();
                             }
                             else
                             {
                                 HideRoleInfodown();
                             }
                         }
                     }
                     else if (doorController != null)
                     {
                         Debug.Log("door");
                     }
                 }
             }
             else
             {
                 HideRoleInfodown();
             }
         }
     });
 }