public static CraftlistItem create(BlueprintDatas _bp, BlueprintDatas _exp, int _count) { CraftlistItem _item = new CraftlistItem(); if (_bp != null) { _item.type = _bp.Type; _item.name = _bp.Name; _item.grade = _bp.Grade; if (_exp != null) { _item.experimental = _exp.Name; } _item.count = _count; _item.compile(); } return(_item); }
public override void Update() { base.Update(); if (!isVisible) { _skipUpdate = true; return; } else if (_skipUpdate) { _skipUpdate = false; return; } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.right)) && m_CursorCoords.X < m_CursorMaxX) { m_CursorCoords.X++; } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.left)) && m_CursorCoords.X > 0) { m_CursorCoords.X--; } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.down))) { if (m_CursorCoords.Y < m_CursorMaxY[m_CursorCoords.X]) { m_CursorCoords.Y++; } else if (m_CursorCoords.X < m_CursorMaxX) { m_CursorCoords.X++; m_CursorCoords.Y = 0; } } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.up))) { if (m_CursorCoords.Y > (m_CursorCoords.X == 0 ? 1 : 0)) { m_CursorCoords.Y--; } else if (m_CursorCoords.X > 0) { m_CursorCoords.X--; m_CursorCoords.Y = m_CursorMaxY[m_CursorCoords.X]; } } //Pick the one NxButton _selected = null; while (_selected == null) { _selected = m_Buttons.Where(x => x.Coords == m_CursorCoords).FirstOrDefault(); if (_selected != null && !_selected.isSelectable) { if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.up))) { m_CursorCoords.Y--; } else { m_CursorCoords.Y++; } _selected = null; continue; } if (_selected == null) { if (m_CursorCoords.Y > 1) { m_CursorCoords.Y--; } else if (m_CursorCoords.X > 0) { m_CursorCoords.X--; } else { break; } } } foreach (NxButton b in m_Buttons) { b.Selected = b == _selected; } if (NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.select)) && _selected != null) { if (_selected.Obj is string) { m_TypeSelected = (string)_selected.Obj; } else if (_selected.Obj is BlueprintDatas) { BlueprintDatas d = (BlueprintDatas)_selected.Obj; BlueprintDatas _maxGrade = EngineerHelper.blueprints.Where(x => x.Type == d.Type && x.Name == d.Name && x.Grade == d.MaxGrade).FirstOrDefault(); m_uiImprove.BlueprintDetails.setBlueprint(_maxGrade); m_uiImprove.changeState(UiImprove.UiImproveState.BlueprintDetail); } refresh(); } }