public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { if (mBrowseOption == null) { mBrowseOption = new WIListOption("Browse Catalogue", "Browse"); } Library library = null; if (Books.Get.Library(State.LibraryName, out library)) { //can we browse this catalogue? Skill learnedSkill = null; if (!string.IsNullOrEmpty(library.RequiredSkill)) { //match the icon to the skill bool hasLearnedSkill = Skills.Get.HasLearnedSkill(library.RequiredSkill, out learnedSkill); mBrowseOption.IconName = learnedSkill.Info.IconName; mBrowseOption.IconColor = learnedSkill.SkillIconColor; mBrowseOption.BackgroundColor = learnedSkill.SkillBorderColor; } else { mBrowseOption.BackgroundColor = Colors.Get.MenuButtonBackgroundColorDefault; mBrowseOption.IconName = string.Empty; mBrowseOption.Disabled = false; } options.Add(mBrowseOption); } }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { if (gAddPowerSource == null) { gAddPowerSource = new WIListOption("Add Power", "AddPowerSource"); gRemovePowerSource = new WIListOption("Remove Power", "RemovePowerSource"); } gAddPowerSource.ObexFont = ObexPowerSource; gRemovePowerSource.ObexFont = ObexPowerSource; //gAddPowerSource.Disabled = true; //gRemovePowerSource.Disabled = true; if (CanRemoveSource) { gRemovePowerSource.OptionText = "Take " + PowerSourceDopplegangerProps.DisplayName; if (State.HasPowerSource) { gRemovePowerSource.Disabled = false; } options.Add(gRemovePowerSource); if (CanReplaceSource) { gAddPowerSource.OptionText = "Add " + PowerSourceDopplegangerProps.DisplayName; if (Player.Local.Tool.IsEquipped && Stacks.Can.Stack(Player.Local.Tool.worlditem, PowerSourceDopplegangerProps)) { gAddPowerSource.Disabled = false; } options.Add(gAddPowerSource); } } }
/*UPGRADE / SWAP OPTIONS * Path types: * ------- * Path * Trail * Road * ----- * PathMarker->TrailMarker->RoadMarker * PathMarker->CrossPath * TrailMarker->CrossTrail * RoadMarker->CrossRoad */ public override WIListOption GetListOption(IItemOfInterest targetObject) { //Debug.Log ("Getting list option for improve path"); WIListOption listOption = base.GetListOption(targetObject); listOption.Flavors.Clear(); mLastflavors.Clear(); HashSet <string> flavors = new HashSet <string> (); PathMarker targetPathMarker = null; if (targetObject.worlditem.Is <PathMarker> (out targetPathMarker)) { ImprovePathMarker(targetPathMarker, flavors); } //keep flavors in the dictionary, we don't know which will be relevant //it's only move and swap for now but there may be more int flavorNum = 0; foreach (string flavor in flavors) { //Debug.Log ("Adding flavor " + flavor); listOption.Flavors.Add(flavor); mLastflavors.Add(flavorNum, flavor); flavorNum++; } return(listOption); }
public override void OnStartup() { if (gSitOption == null) { gSitOption = new WIListOption("Sit", "Sit"); gWaitOption = new WIListOption("Wait", "Wait"); } }
public override WIListOption GetListOption(IItemOfInterest targetObject) { WIListOption option = base.GetListOption(targetObject); option.Flavors.Clear(); option.OptionText = "Barter"; option.DefaultFlavorIndex = -1; option.Disabled = false; //barter targets the owner of objects, not the object itself, so check if the owner is a shop owner if (targetObject.IOIType == ItemOfInterestType.WorldItem && targetObject.worlditem.Is <ShopOwner> ()) { //only do this if it's an actual worlditem //get the thing we're focusing on if (Player.Local.Surroundings.IsWorldItemInRange && !Player.Local.Surroundings.WorldItemFocus.worlditem.Is <OwnedByPlayer> () && Player.Local.Surroundings.WorldItemFocus.worlditem != targetObject.worlditem) { option.DefaultFlavorIndex = BuyFlavor; option.OptionText = "Buy for $" + Player.Local.Surroundings.WorldItemFocus.worlditem.BaseCurrencyValue.ToString(); } } else { //don't make it possible to barter for books BookAvatar bookAvatar = null; try { if (Player.Local.Surroundings.WorldItemFocus.worlditem.Is <BookAvatar> (out bookAvatar) && !bookAvatar.worlditem.Is <OwnedByPlayer> ()) { option.DefaultFlavorIndex = BuyFlavor; Book b = null; if (Books.Get.BookByName(bookAvatar.State.BookName, out b)) { if (b.TypeOfBook == BookType.Diary) { //can't buy diaries option.Disabled = true; option.OptionText = "Won't sell"; } else { option.OptionText = "Buy for $" + Player.Local.Surroundings.WorldItemFocus.worlditem.BaseCurrencyValue.ToString(); } } else { option.Disabled = true; } } } catch (Exception e) { Debug.Log("Couldn't get option because: " + e.ToString()); option.Disabled = true; } } return(option); }
public override void OnStartup() { if (mForSaleOption == null) { mClaimOption = new WIListOption("Claim property", "Claim"); mRenameOption = new WIListOption("Rename property", "Rename"); mForSaleOption = new WIListOption("Buy property", "Buy"); mRestoreOption = new WIListOption("Restore property", "Restore"); } }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { if (State.HasBeenCreated) { if (gRenameOption == null) { gRenameOption = new WIListOption("Rename Campsite", "Rename"); } options.Add(gRenameOption); } }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { WIListOption listOption = new WIListOption("HouseOfHealing", "Request Rescue Services", "Rescue"); if (State.ChosenByPlayer) { listOption.OptionText = "Cancel Rescue Services"; listOption.NegateIcon = true; } options.Add(listOption); }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { if (gPluckOption == null) { gPluckOption = new WIListOption("Pluck", "Pluck"); } if (!creature.IsDead) { options.Add(gPluckOption); } }
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; } } }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { if (gShearOption == null) { gShearOption = new WIListOption("Shear", "Shear"); } //TODO make it impossible to shear a creature more than [x] times per [y] if (!creature.IsDead) { //don't require shears or anything yet, we'll add that later options.Add(gShearOption); } }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { if (worlditem.Group == WIGroups.Get.Player && worlditem.Is(WIMode.Equipped | WIMode.Frozen | WIMode.World)) { if (CanWear(Type, BodyPart, Orientation, worlditem)) { WIListOption listOption = new WIListOption("Wear", "Wear"); if (Player.Local.Wearables.IsWearing(Type, BodyPart, Orientation)) { listOption.Disabled = true; } options.Add(listOption); } } }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { if (!FindElevator()) { return; } if (gElevatorUpOption == null) { gElevatorUpOption = new WIListOption("Elevator Up", "Up"); //gElevatorUpOption.ObexFont = true; gElevatorDownOption = new WIListOption("Elevator Down", "Up"); //gElevatorDownOption.ObexFont = true; gElevatorCallOption = new WIListOption("Call Elevator", "Call"); //gElevatorCallOption.ObexFont = true; } if (HasUpperFloor) { gElevatorUpOption.Disabled = !(PowerSource.HasPower && TargetElevator.PlayerIsOnElevator && MissionCondition.CheckCondition(State.UpperFloorCondition)); options.Add(gElevatorUpOption); if (gElevatorUpOption.Disabled) { Debug.Log("upper disabled. has power? " + PowerSource.HasPower.ToString() + " player on elevator? " + TargetElevator.PlayerIsOnElevator.ToString() + " condition? " + MissionCondition.CheckCondition(State.UpperFloorCondition).ToString() + " " + State.StopIndex.ToString()); } } if (HasLowerFloor) { gElevatorDownOption.Disabled = !(PowerSource.HasPower && !TargetElevator.PlayerIsOnElevator && !MissionCondition.CheckCondition(State.LowerFloorCondition)); options.Add(gElevatorDownOption); if (gElevatorDownOption.Disabled) { Debug.Log("lower disabled. has power? " + PowerSource.HasPower.ToString() + " player on elevator? " + TargetElevator.PlayerIsOnElevator.ToString() + " condition? " + MissionCondition.CheckCondition(State.LowerFloorCondition).ToString() + " " + State.StopIndex.ToString()); } } gElevatorCallOption.Disabled = !(PowerSource.HasPower && TargetElevator.CurrentStopIndex != State.StopIndex && MissionCondition.CheckCondition(State.CallElevatorCondition) && !TargetElevator.PlayerIsOnElevator); if (gElevatorCallOption.Disabled) { Debug.Log("call disabled. has power? " + PowerSource.HasPower.ToString() + " already on floor? " + (TargetElevator.CurrentStopIndex == State.StopIndex).ToString() + " condition? " + MissionCondition.CheckCondition(State.CallElevatorCondition).ToString() + " " + State.StopIndex.ToString()); } options.Add(gElevatorCallOption); gElevatorUpOption.Disabled = false; gElevatorDownOption.Disabled = false; gElevatorCallOption.Disabled = false; }
public override void PopulateOptionsList(System.Collections.Generic.List <WIListOption> options, List <string> message) { if (character.IsDead || character.IsStunned || character.IsSleeping) { return; } if (!string.IsNullOrEmpty(State.DTSSpeechName) || !string.IsNullOrEmpty(State.ConversationName)) { WIListOption talkOption = new WIListOption("Talk"); if (State.GivingSpeech && !mSpeech.speech.CanBeInterrupted) { talkOption.Disabled = true; } options.Add(talkOption); } }
public virtual void RemoveOption(string optionResult) { WIListOption optionToRemove = null; foreach (WIListOption option in Options) { if (option.Result == optionResult) { optionToRemove = option; break; } } if (optionToRemove != null) { Options.Remove(optionToRemove); } }
public virtual void AddOption(WIListOption option) { if (WIListOption.IsNullOrInvalid(option)) { return; } if (!ContainsOption(option.Result)) { Options.Add(option); EnableOptionsList(); if (PlayerFocus) { GUIManager.PostInfo(PostedMessage); } } }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { if (State.IsEmpty) { WIListOption option = new WIListOption("(Empty)", "Drink"); option.Disabled = true; options.Add(option); } else { if (Player.Local.Status.HasCondition("BurnedByFire")) { options.Add(new WIListOption("Pour on Self", "PourOnSelf")); } options.Add(new WIListOption("Pour Out")); options.Add(new WIListOption("Drink " + State.Contents.DisplayName, "Drink")); } }
public override WIListOption GetListOption(IItemOfInterest targetObject) { if (targetObject.IOIType != ItemOfInterestType.WorldItem) { return(WIListOption.Empty); } PathMarker pathMarker = null; if (!Paths.HasActivePath || !targetObject.worlditem.Is <PathMarker> (out pathMarker)) { return(WIListOption.Empty); } WIListOption listOption = base.GetListOption(targetObject); List <string> flavors = new List <string> (); flavors.Add("Remove"); flavors.Add("Move"); listOption.Flavors = flavors; return(listOption); }
protected bool CreateButton(WIListOption option, int flavorIndex, float buttonPosition, string functionName) { if (!option.IsValid) { #if DEBUG_SKILLS Debug.Log("Invalid option " + option.OptionText + " - not creating button"); #endif return(false); } UIButton randomPrototype = ButtonPrototypes [UnityEngine.Random.Range(0, ButtonPrototypes.Count)]; UIButton newButton = NGUITools.AddChild(ScreenEdgeOffset.gameObject, randomPrototype.gameObject).GetComponent <UIButton> (); UISprite newButtonBackground = newButton.transform.FindChild("Background").GetComponent <UISprite> (); UISprite newButtonSelection = newButton.transform.FindChild("Selection").GetComponent <UISprite> (); UILabel newButtonLabel = newButton.transform.FindChild("Label").GetComponent <UILabel> (); UISprite overlaySprite = newButton.transform.FindChild("Overlay").GetComponent <UISprite> (); newButton.hover = Colors.Get.GeneralHighlightColor; newButton.defaultColor = Colors.Darken(Colors.Get.GeneralHighlightColor, 0f); newButtonSelection.color = Colors.Darken(Colors.Get.GeneralHighlightColor, 0f); newButtonLabel.effectColor = Colors.Get.MenuButtonTextOutlineColor; newButtonLabel.effectStyle = UILabel.Effect.Shadow; //UILabel.Effect.Outline; newButtonLabel.text = option.OptionText; newButton.name = option.Result; newButtonLabel.color = option.TextColor; if (option.ObexFont) { newButtonLabel.useDefaultLabelFont = false; newButtonLabel.multiLine = false; newButtonLabel.transform.localScale = Vector3.one * 15f; newButtonLabel.font = Mats.Get.ObexFont; } if (flavorIndex >= 0) { if (flavorIndex < option.Flavors.Count) { if (string.IsNullOrEmpty(option.Flavors [flavorIndex])) { return(false); } else { newButtonLabel.text = option.Flavors [flavorIndex]; newButton.name += "_" + flavorIndex.ToString(); } } else { newButton.name = option.Result + "_" + flavorIndex.ToString(); } } Transform currencyTransform = newButton.transform.FindChild("Currency"); if (option.RequiresCurrency) { Transform currencyLabelTransform = currencyTransform.Find("CurrencyLabel"); Transform currencyDopplegangerParent = currencyTransform.Find("CurrencyDopplegangerParent"); UILabel currencyLabel = currencyLabelTransform.gameObject.GetComponent <UILabel> (); string inventoryItemName = string.Empty; GenericWorldItem currencyDopplegangerProps = null; switch (option.RequiredCurrencyType) { case WICurrencyType.A_Bronze: default: currencyDopplegangerProps = Currency.BronzeGenericWorldItem; inventoryItemName = Currency.BronzeCurrencyNamePlural; break; case WICurrencyType.B_Silver: currencyDopplegangerProps = Currency.SilverGenericWorldItem; inventoryItemName = Currency.SilverCurrencyNamePlural; break; case WICurrencyType.C_Gold: currencyDopplegangerProps = Currency.GoldIGenericWorldItem; inventoryItemName = Currency.GoldCurrencyNamePlural; break; case WICurrencyType.D_Luminite: currencyDopplegangerProps = Currency.LumenGenericWorldItem; inventoryItemName = Currency.LumenCurrencyNamePlural; break; case WICurrencyType.E_Warlock: currencyDopplegangerProps = Currency.WarlockGenericWorldItem; inventoryItemName = Currency.WarlockCurrencyNamePlural; break; } currencyLabel.text = option.CurrencyValue.ToString() + " " + inventoryItemName; GameObject currencyDoppleganger = WorldItems.GetDoppleganger(currencyDopplegangerProps, currencyDopplegangerParent, null, WIMode.Stacked, 1f); } else { currencyTransform.gameObject.SetActive(false); } if (option.Disabled) { newButton.SendMessage("SetDisabled"); newButton.enabled = false; newButtonBackground.color = Colors.Disabled(option.BackgroundColor); newButtonLabel.color = Colors.Disabled(option.TextColor); newButton.hover = Colors.Disabled(newButton.hover); overlaySprite.color = option.OverlayColor; UIButtonScale newButtonScale = newButton.GetComponent <UIButtonScale> (); newButtonScale.enabled = false; } else { newButton.SendMessage("SetEnabled"); newButtonBackground.color = option.BackgroundColor; newButtonLabel.color = option.TextColor; overlaySprite.color = option.OverlayColor; UIButtonMessage newButtonMessage = newButton.GetComponent <UIButtonMessage> (); newButtonMessage.target = this.gameObject; newButtonMessage.functionName = functionName; } newButton.transform.localPosition = new Vector3(0.0f, buttonPosition, 0.0f); Transform credentialsTransform = newButton.transform.FindChild("Credentials"); if (string.IsNullOrEmpty(option.CredentialsIconName)) { credentialsTransform.gameObject.SetActive(false); } else { Transform spriteTransform = credentialsTransform.FindChild("CredentialsSprite"); Transform spriteBackgroundTransform = credentialsTransform.transform.FindChild("CredentialsBackground"); UISprite sprite = spriteTransform.gameObject.GetComponent <UISprite> (); UISprite backgroundSprite = spriteBackgroundTransform.gameObject.GetComponent <UISprite> (); sprite.spriteName = option.CredentialsIconName; sprite.color = newButtonBackground.color; backgroundSprite.enabled = true; backgroundSprite.color = option.IconColor; } Transform iconTransform = newButton.transform.FindChild("Icon"); if (string.IsNullOrEmpty(option.IconName)) { iconTransform.gameObject.SetActive(false); } else { Transform spriteTransform = iconTransform.FindChild("IconSprite"); Transform spriteBackgroundTransform = iconTransform.transform.FindChild("IconBackground"); Transform negateIconTransform = iconTransform.transform.FindChild("NegateIcon"); UISprite negateIconSprite = negateIconTransform.gameObject.GetComponent <UISprite> (); UISprite sprite = spriteTransform.gameObject.GetComponent <UISprite> (); UISprite backgroundSprite = spriteBackgroundTransform.gameObject.GetComponent <UISprite> (); sprite.spriteName = option.IconName; sprite.color = option.IconColor; backgroundSprite.enabled = true; backgroundSprite.color = option.BackgroundColor; if (option.Disabled) { sprite.color = Colors.Blacken(sprite.color); } if (option.NegateIcon) { negateIconSprite.enabled = true; } else { negateIconSprite.enabled = false; } backgroundSprite.color = option.BackgroundColor; } return(true); }
public override void PopulateOptionsList(List <WIListOption> options, List <string> message) { mSleptManually = false; if (!string.IsNullOrEmpty(RequiredState) && worlditem.State != RequiredState) { return; } if (!CanBeUsedManually || !State.HasBeenActivated) { return; } RequiresPayment = false; CostOfUse = 0; IStackOwner owner = null; if (worlditem.Group.HasOwner(out owner) && owner.IsWorldItem) { owner.worlditem.Is <InnKeeper>(out ParentInkeeper); owner.worlditem.Is <Character>(out ParentResident); } if (HasParentInnkeeper) { if (!ParentInkeeper.HasPaid) { RequiresPayment = true; CostOfUse = ParentInkeeper.PricePerNight; } } else if (HasParentResident) { //we can only sleep in residence houses if we know the character if (!Characters.KnowsPlayer(ParentResident.worlditem.FileName)) { return; } } WIListOption dawn = new WIListOption("Sleep 'til Dawn", "Dawn"); if (WorldClock.IsTimeOfDay(TimeOfDay.ad_TimeDawn) || RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse)) { dawn.Disabled = true; } options.Add(dawn); WIListOption noon = new WIListOption("Sleep 'til Noon", "Noon"); if (WorldClock.IsTimeOfDay(TimeOfDay.ag_TimeNoon) || RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse)) { noon.Disabled = true; } options.Add(noon); WIListOption dusk = new WIListOption("Sleep 'til Dusk", "Dusk"); if (WorldClock.IsTimeOfDay(TimeOfDay.aj_TimeDusk) || RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse)) { dusk.Disabled = true; } options.Add(dusk); WIListOption midnight = new WIListOption("Sleep 'til Midnight", "Midnight"); if (WorldClock.IsTimeOfDay(TimeOfDay.aa_TimeMidnight) || RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse)) { midnight.Disabled = true; } options.Add(midnight); if (RequiresPayment) { dawn.RequiredCurrencyType = WICurrencyType.A_Bronze; noon.RequiredCurrencyType = WICurrencyType.A_Bronze; dusk.RequiredCurrencyType = WICurrencyType.A_Bronze; midnight.RequiredCurrencyType = WICurrencyType.A_Bronze; dawn.CurrencyValue = CostOfUse; noon.CurrencyValue = CostOfUse; dusk.CurrencyValue = CostOfUse; midnight.CurrencyValue = CostOfUse; } }