public void Start() { Enabler = Stacks.Create.StackEnabler(WIGroups.Get.Player); ContainerDisplay.EnablerDisplayPrefab = GUIManager.Get.InventorySquareEnablerDisplay; ContainerDisplay.UseVisualEnabler = true; ContainerDisplay.SetEnabler(Enabler); ContainerDisplay.Hide(); ShowHideButton.target = gameObject; ShowHideButton.functionName = "OnClickShowHideButton"; ContainerName.text = "(No container opened)"; }
protected override void OnRefresh() { if (BarterMode == BarterContainerMode.Goods) { //if we're goods, then we have an enabler //and we're displaying its contents normally //so refresh normally base.OnRefresh(); } else { CreateSquares(); //can't do anything without a session if (Session == null || !Session.IsActive) { for (int i = 0; i < InventorySquares.Count; i++) { InventorySquares[i].DropStack(); } return; } //if we're an offer container, then we're displaying something else //we're not using a stack to update squares, we're using goods List <BarterGoods> goods = new List <BarterGoods>(); WIStackEnabler enabler = null; if (Party == BarterParty.Player) { goods = Session.PlayerGoods; enabler = Session.CurrentPlayerStackEnabler; } else { goods = Session.CharacterGoods; enabler = Session.CurrentCharacterStackEnabler; } for (int i = 0; i < InventorySquares.Count; i++) { InventorySquareBarterOffer square = InventorySquares[i].GetComponent <InventorySquareBarterOffer>(); square.SetGoods(goods[i]); } } }
public virtual void SetEnabler(WIStackEnabler enabler) { if (HasEnabler) { if (enabler != null) { if (mEnabler != enabler) //if it's not the same //and our current enabler uses our refresh action //clear the refresh action for the current enabler { mEnabler.RefreshAction -= mRefreshRequest; } mEnabler = enabler; mEnabler.Display = this; mEnabler.RefreshAction += mRefreshRequest; } else //clear the enabler's refresh action //set our enabler to null and we're done { mEnabler.RefreshAction -= mRefreshRequest; mEnabler = null; if (UseVisualEnabler) { EnablerDisplay.SetStack(null); } } } //if we don't have an enabler and the new one isn't null else if (enabler != null) { mEnabler = enabler; mEnabler.RefreshAction += mRefreshRequest; } if (UseVisualEnabler && EnablerDisplay != null && mEnabler != null) { EnablerDisplay.SetStack(mEnabler.EnablerStack); } RefreshRequest(); }
public void SetCharacterInventoryContainer(WIStackEnabler enabler) { CharacterInventoryDisplay.SetEnabler(enabler); mWaitingForContainer = false; }
public GetInventoryContainerResult(WIStackEnabler containerEnabler, int containerIndex) { ContainerEnabler = containerEnabler; ContainerIndex = containerIndex; }