void HideMerchantDialog() { mState = MerchantState.Standard; AtavismUiSystem.RemoveFrame("MerchantDialog", new Rect(0, 0, 0, 0)); }
void ShowPurchaseWindow(MerchantItem mItem) { confirmBoxRect = new Rect((Screen.width - 200) / 2, (Screen.height - 75) / 2, 150, 100); mState = MerchantState.Purchase; selectedItem = mItem; AtavismUiSystem.AddFrame("MerchantDialog", uiRect); }
void ShowSellWindow(AtavismInventoryItem item) { confirmBoxRect = new Rect((Screen.width - 200) / 2, (Screen.height - 75) / 2, 150, 100); mState = MerchantState.Sell; itemBeingSold = item; AtavismUiSystem.AddFrame("MerchantDialog", uiRect); }
private void MERCHANT_HANDLE(MerchantState parState) { Console.WriteLine("Handling merchant"); switch (parState) { case MerchantState.SHOW: if (thrMerchUpdate != null && thrMerchUpdate.Status == TaskStatus.Running) { Console.WriteLine("Task is stil running. Returning here"); return; } Console.WriteLine("Creating the action"); Action tmpAction = () => { thrMerchUpdate = new Task(() => { Console.WriteLine("Checking Vendor Guid"); if (ObjectManager.Instance.Player.VendorGuid == 0) { Console.WriteLine("Vendor Guid is 0 ... returning"); return; } if (MerchantFrame.IsOpen) { Console.WriteLine("Merchant frame marked as open. Destroying the old object and recreating"); MerchantFrame.Destroy(); } Console.WriteLine("Creating the new frame"); MerchantFrame.Create(); }); thrMerchUpdate.ContinueWith(task => { Console.WriteLine("Finalising merchant event"); if (!MerchantFrame.IsOpen) { return; } #if OUTPUT Console.WriteLine("MERCHANT PARSED"); Console.WriteLine($"Total items: {MerchantFrame.Instance.Items.Count}"); foreach (var v in MerchantFrame.Instance.Items) { Console.WriteLine("\tItem" + v.VendorItemNumber + ": " + v.Name + "\n\tCan Use: " + v.CanUse + "\n\tPrice: " + v.Price + "\n\tQuantity: " + v.Quantity + "\n\tAvaible: " + v.NumAvaible + "\n"); } Console.WriteLine(); #endif Console.WriteLine("Invoking OnMerchantShow"); OnMerchantShow?.Invoke(this, new EventArgs()); }); thrMerchUpdate.Start(); }; Console.WriteLine("Running the action from EndScene"); DirectX.Instance.Execute(tmpAction, 200); break; case MerchantState.CLOSE: MerchantFrame.Destroy(); thrMerchUpdate = null; OnMerchantClosed?.Invoke(this, new EventArgs()); break; } }