// text colour private void tvwEquip_DrawText(object sender, DrawEventArgs e) { e.TextBrush = new SolidBrush(Color.FromArgb(224, 224, 224)); // default forecolor if (sender == tvwEquipTxtName) { return; } EquipNode node = (EquipNode)e.Node.Tag; int col = -1; if (sender == tvwEquipTxtNum1) { col = 1; } else if (sender == tvwEquipTxtNum2) { col = 2; } else if (sender == tvwEquipTxtNum3) { col = 3; } else if (sender == tvwEquipTxtNum4) { col = 4; } else if (sender == tvwEquipTxtNum5) { col = 5; } if (node.GetColValue(col) == "-") { e.TextBrush = new SolidBrush(Color.FromArgb(128, 128, 128)); } else { e.TextBrush = new SolidBrush(Color.FromArgb(224, 224, 224)); } int cycle = node.GetColCycle(col); if (cycle >= 0 && cycle == node.CurrentCycle) { e.BackgroundBrush = new SolidBrush(Color.FromArgb(80, 80, 80)); } }
// update new vehicle info private void tvwEquip_SelectionChanged(object sender, EventArgs e) { // get selected node if (tvwEquip.SelectedNode != null) { EquipNode node = (EquipNode)tvwEquip.SelectedNode.Tag; this.selectedVehicle = node.Vehicle; this.selectedToe = this.selectedVehicle == null ? null : ((EquipNode)node.Parent.Parent).Toe; } else { this.selectedVehicle = null; this.selectedToe = null; } // update controls UpdateVehicleInfo(); }
public void init(Transform _roletrans) { _equipnodes = new Dictionary <ModelEnum, EquipNode> (); EquipNode _weaponnode = new EquipNode("Dummy Prop Right"); _weaponnode._BObject = true; _equipnodes.Add(ModelEnum.EqWeapon, _weaponnode); EquipNode _subweaponnode = new EquipNode("Dummy Prop Left"); _subweaponnode._BObject = true; _equipnodes.Add(ModelEnum.EqSubWeapon, _subweaponnode); EquipNode _hatnode = new EquipNode("Dummy Prop Head"); _hatnode._BObject = true; _equipnodes.Add(ModelEnum.EqHats, _hatnode); EquipNode _armornode = new EquipNode("Base"); _armornode._BObject = true; _equipnodes.Add(ModelEnum.EqArmor, _armornode); EquipNode _glovenode = new EquipNode(); _equipnodes.Add(ModelEnum.EqGloves, _glovenode); EquipNode _pantsnode = new EquipNode(); _equipnodes.Add(ModelEnum.EqPants, _pantsnode); EquipNode _bootsnode = new EquipNode(); _equipnodes.Add(ModelEnum.EqBoots, _bootsnode); EquipNode _wingnode = new EquipNode("Dummy Prop Back"); _wingnode._BObject = true; _equipnodes.Add(ModelEnum.EqWings, _wingnode); EquipNode _necklacenode = new EquipNode(); _equipnodes.Add(ModelEnum.EqNeckLace, _necklacenode); EquipNode _braceletnode = new EquipNode(); _equipnodes.Add(ModelEnum.EqBraceLet, _braceletnode); EquipNode _jadenode = new EquipNode(); _equipnodes.Add(ModelEnum.EqJade, _jadenode); Transform[] _nodes = _roletrans.GetComponentsInChildren <Transform>(); foreach (Transform _tr in _nodes) { foreach (ModelEnum _item in _equipnodes.Keys) { if (_tr.name.Equals(_equipnodes[_item]._BoneNodeName)) { _equipnodes[_item]._BoneNode = _tr; } } } }
/// <summary> /// Populates the equipment tree by adding country, toe, vehicle class, and vehicle nodes. /// </summary> private void PopulateTree() { TreeModel model = (TreeModel)tvwEquip.Model; tvwEquip.BeginUpdate(); // foreach country foreach (Country country in game.Countries) { if (!country.IsActive) { continue; } Node countryNode = new EquipNode(country.Name); model.Nodes.Add(countryNode); // for each toe in country foreach (Toe toe in game.Toes.Values) { if (toe.Country != country) { continue; } Node toeNode = new EquipNode(toe); countryNode.Nodes.Add(toeNode); // get all classes in toe List <VehicleClass> vehclasses = new List <VehicleClass>(); foreach (Vehicle vehicle in toe.Vehicles) { if (!vehclasses.Contains(vehicle.Class)) { vehclasses.Add(vehicle.Class); } } vehclasses.Sort(); // for each vehicle class in toe foreach (VehicleClass vehclass in vehclasses) { Node classNode = new EquipNode(vehclass.Name); toeNode.Nodes.Add(classNode); // get all vehicles in class List <Vehicle> vehicles = new List <Vehicle>(); foreach (Vehicle vehicle in toe.Vehicles) { if (vehicle.Class == vehclass) { vehicles.Add(vehicle); } } vehicles.Sort(); // for each vehicle in class foreach (Vehicle vehicle in vehicles) { Node vehicleNode = new EquipNode(toe, vehicle); classNode.Nodes.Add(vehicleNode); // remember highest seen cycle number if (toe[vehicle].Cycle.Length - 1 > this.maxCycle) { this.maxCycle = toe[vehicle].Cycle.Length - 1; } } // end foreach vehicle } // end foreach vehicle class } // end foreach toe } // end foreach country if (this.maxCycle < 0) { this.maxCycle = 0; } tvwEquip.EndUpdate(); }