void Update() { timer += Time.deltaTime; if (player == null) { player = FindObjectOfType <PlayerMovement>(); } if (playerAttacking == null) { playerAttacking = FindObjectOfType <PlayerAttack>(); } if (pauseMenu == null) { pauseMenu = FindObjectOfType <PauseMenu>(); } if (tradeMenu == null) { tradeMenu = FindObjectOfType <TradeMenu>(); } if (timer > 0.75f) { leftTouchCount = 0; rightTouchCount = 0; timer = 0f; } }
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { var node = e.Node; if (node == null) { return; } if (node.Tag != null) { TradeMenu trade = node.Tag as TradeMenu; if (trade == null) { return; } try { if (!string.IsNullOrEmpty(trade.ActionName)) { _mainForm.TradeContainer.OpenTrade(trade.ActionName); } } catch (Exception) { MessageBox.Show(string.Format("无法打开交易 {0}", trade.ActionName)); } } }
public void GetButton() { if (menu == null) { menu = FindObjectOfType <TradeMenu>(); TradeMenu.current.AddToMenu(this); } }
private void Awake() { if (menu == null) { menu = FindObjectOfType <TradeMenu>(); menu.AddToMenu(this); } }
private void Awake() { current = this; //playerItemButtons = new List<TradeButton>(); //npcItemButtons = new List<TradeButton>(); playerNameTxt.text = SaveData.current.profile.playerName; playerTradeList = new List <string>(); npcTradeList = new List <string>(); GetButtons(); GameEvents.current.onCallBarter += DisplayTrade; }
void LoadTreeNode(TradeMenu category, TreeNode parentTreeNode) { foreach (var trade in category.Children) { TreeNode tn = new TreeNode(trade.Title); tn.Tag = trade; parentTreeNode.Nodes.Add(tn); if (trade.Children != null) { LoadTreeNode(trade, tn); } } }
private void OnClick_DisplayTradeMenu(object sender, RoutedEventArgs e) { if (!_gameSession.HasTrader) { return; } TradeMenu tradeMenu = new TradeMenu() { Owner = this, DataContext = _gameSession }; tradeMenu.ShowDialog(); }
void SetMenuSource(XElement parentElement, TradeMenu parentCategory) { List <TradeMenu> lstMenu = new List <TradeMenu>(); foreach (var element in parentElement.Elements()) { TradeMenu cate = new TradeMenu(); cate.Title = element.Attribute("title").Value; cate.ActionName = element.Attribute("action").Value; if (element.HasElements) { SetMenuSource(element, cate); } lstMenu.Add(cate); } parentCategory.Children = lstMenu; }
void SelectTarget() { ClearHighlightedArea(); if (ActionMenu.Action == ActionMenu.ActionState.attack) { Fighter f = Map.GetCellData(Crosshair.transform.position).unitInTile; Battle(Fighter, f, GameSettings.DoBattleAnimation); } if (ActionMenu.Action == ActionMenu.ActionState.staff) { Fighter f = Map.GetCellData(Crosshair.transform.position).unitInTile; Debug.LogError("NYI"); } if (ActionMenu.Action == ActionMenu.ActionState.trade) { Fighter f = Map.GetCellData(Crosshair.transform.position).unitInTile; TradeMenu.Open(Fighter, f); } }
void SetMenuSource() { List <TradeMenu> lstMenu = new List <TradeMenu>(); XDocument doc = XDocument.Load("Menu.xml"); var root = doc.Element("menu"); foreach (var element in root.Elements()) { TradeMenu cate = new TradeMenu(); cate.Title = element.Attribute("title").Value; var att = element.Attribute("action"); cate.ActionName = att == null ? null : att.Value; if (element.HasElements) { SetMenuSource(element, cate); } lstMenu.Add(cate); } MainForm.LoadMenu(lstMenu); }
private void Awake() { instance = this; }