public void ShowRespawnList() { //add the option list we'll use to select the skill SpawnOptionsList optionsList = gameObject.GetOrAdd <SpawnOptionsList>(); optionsList.MessageType = "Use Respawn Skill"; optionsList.Message = string.Empty; optionsList.FunctionName = "OnSelectSpawnSkill"; optionsList.RequireManualEnable = false; optionsList.OverrideBaseAvailabilty = true; optionsList.FunctionTarget = gameObject; optionsList.PositionTarget = UICamera.currentCamera.WorldToScreenPoint(transform.position); mSpawnSkills.Clear(); mSpawnSkills.AddRange(Skills.Get.SkillsByType <RespawnSkill>()); if (mSpawnSkills.Count > 0) { foreach (Skill spawnSkill in mSpawnSkills) { optionsList.AddOption(spawnSkill.GetListOption(Player.Local)); } } else { optionsList.AddOption(new WIListOption("Revive", "DefaultRevive")); } //the list can't go away unless the player makes a choice optionsList.ForceChoice = true; if (optionsList.TryToSpawn(true, out OptionListDialog, null)) { Debug.Log("Trying to spawn options list..."); UsingSkillList = 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; } } }
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; } }