Beispiel #1
0
        public virtual bool TryToSpawn(bool forceSpawn, out GUIOptionListDialog childEditor, Camera nguiCamera)
        {
            childEditor = null;
            if (mChildEditor != null)
            {
                return(false);
            }

            childEditor = SpawnOptionsDialog(nguiCamera);
            return(true);
        }
        protected override void OnRightClickSquare()
        {
            //right clicking a blueprint square opens a menu
            //where you can select the blueprint used to create the item
            //or you can bring the item in from your inventory
            if (EnabledForBlueprint)
            {
                bool             canCraft    = RequirementCanBeCrafted;
                bool             canPlace    = Player.Local.Inventory.FindFirstByKeyword(DopplegangerProps.PrefabName, out gCheckItem, out gCheckStack);
                SpawnOptionsList optionsList = gameObject.GetOrAdd <SpawnOptionsList>();
                optionsList.MessageType = string.Empty;                                                //"Take " + mSkillUseTarget.DisplayName;
                if (canCraft && canPlace)
                {
                    optionsList.Message = "Craft or Add Item";
                }
                else if (canCraft)
                {
                    optionsList.Message = "Craft Item";
                }
                else
                {
                    optionsList.Message = "Add Item";
                }
                optionsList.FunctionName            = "OnSelectBlueprint";
                optionsList.RequireManualEnable     = false;
                optionsList.OverrideBaseAvailabilty = true;
                optionsList.FunctionTarget          = gameObject;
                if (gCraftOption == null)
                {
                    gCraftOption  = new WIListOption("Craft", "Craft");
                    gPlaceOption  = new WIListOption("Place", "Place");
                    gCancelOption = new WIListOption("Cancel", "Cancel");
                }
                gCraftOption.OptionText = "Craft " + DopplegangerProps.DisplayName;
                gCraftOption.Disabled   = !canCraft;
                gPlaceOption.OptionText = "Place " + DopplegangerProps.DisplayName;
                gPlaceOption.Divider    = !canPlace;

                optionsList.AddOption(gCraftOption);
                optionsList.AddOption(gPlaceOption);
                optionsList.AddOption(gCancelOption);

                optionsList.ShowDoppleganger = false;
                GUIOptionListDialog dialog = null;
                if (optionsList.TryToSpawn(true, out dialog, NGUICamera))
                {
                    UsingMenu = true;
                    optionsList.ScreenTarget       = transform;
                    optionsList.ScreenTargetCamera = NGUICamera;
                }
            }
        }
Beispiel #3
0
        protected void UseSkillsToRemoveStack()
        {                               //this whole method is very brittle
            //look into ways to keep this from blowing things up
            if (UsingMenu)
            {
                return;
            }

            //add the option list we'll use to select the skill
            SpawnOptionsList optionsList = gameObject.GetOrAdd <SpawnOptionsList>();

            optionsList.MessageType             = string.Empty;                        //"Take " + mSkillUseTarget.DisplayName;
            optionsList.Message                 = "Use a skill to take";
            optionsList.FunctionName            = "OnSelectRemoveSkill";
            optionsList.RequireManualEnable     = false;
            optionsList.OverrideBaseAvailabilty = true;
            optionsList.FunctionTarget          = gameObject;
            mRemoveSkillList.Clear();
            mRemoveSkillList.AddRange(Skills.Get.SkillsByName(mRemoveItemSkillNames));
            foreach (Skill removeItemSkill in mRemoveSkillList)
            {
                if (mSkillUseTarget.IsWorldItem && mSkillUseTarget.worlditem != null)
                {
                    optionsList.AddOption(removeItemSkill.GetListOption(mSkillUseTarget.worlditem));
                }
                else
                {
                    //why are we here??
                    Debug.LogError("Remove item skill worlditem was NULL or wasn't world item");
                }
            }
            optionsList.AddOption(new WIListOption("Cancel"));
            optionsList.ShowDoppleganger = false;
            GUIOptionListDialog dialog = null;

            if (optionsList.TryToSpawn(true, out dialog, NGUICamera))
            {
                UsingMenu = true;
                optionsList.ScreenTarget       = transform;
                optionsList.ScreenTargetCamera = NGUICamera;
            }
        }