private static void UpdateGUIFrame(Item item, Character character) { if (frame == null) { return; } bool unfixedFound = false; foreach (GUIComponent child in frame.children) { FixRequirement requirement = child.UserData as FixRequirement; if (requirement == null) { continue; } if (requirement.Fixed) { child.Color = Color.LightGreen * 0.3f; child.GetChild <GUITickBox>().Selected = true; } else { bool canBeFixed = requirement.CanBeFixed(character, child); unfixedFound = true; //child.GetChild<GUITickBox>().Selected = canBeFixed; GUITickBox tickBox = child.GetChild <GUITickBox>(); if (tickBox.Selected) { tickBox.Selected = canBeFixed; requirement.Fixed = canBeFixed; } child.Color = Color.Red * 0.2f; //tickBox.State = GUIComponent.ComponentState.None; } } if (!unfixedFound) { item.Condition = 100.0f; frame = null; } }
public virtual void DrawHUD(SpriteBatch spriteBatch, Camera cam, Character character) { if (condition <= 0.0f) { FixRequirement.DrawHud(spriteBatch, this, character); return; } if (HasInGameEditableProperties) { DrawEditing(spriteBatch, cam); } foreach (ItemComponent ic in components) { if (ic.CanBeSelected) { ic.DrawHUD(spriteBatch, character); } } }
public virtual void UpdateHUD(Camera cam, Character character) { if (condition <= 0.0f) { FixRequirement.UpdateHud(this, character); return; } if (HasInGameEditableProperties) { UpdateEditing(cam); } foreach (ItemComponent ic in components) { if (ic.CanBeSelected) { ic.UpdateHUD(character); } } }
public override void AddToGUIUpdateList() { if (Screen.Selected is EditMapScreen) { if (editingHUD != null) { editingHUD.AddToGUIUpdateList(); } } else { if (HasInGameEditableProperties) { if (editingHUD != null) { editingHUD.AddToGUIUpdateList(); } } } if (Character.Controlled != null && Character.Controlled.SelectedConstruction == this) { if (condition <= 0.0f) { FixRequirement.AddToGUIUpdateList(); return; } foreach (ItemComponent ic in components) { if (ic.CanBeSelected) { ic.AddToGUIUpdateList(); } } } }
private static bool FixButtonPressed(GUIButton button, object obj) { FixRequirement requirement = obj as FixRequirement; if (requirement == null) { return(true); } Item item = frame.UserData as Item; if (item == null) { return(true); } if (!requirement.CanBeFixed(Character.Controlled, button.Parent)) { return(true); } if (GameMain.Client != null) { GameMain.Client.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.Repair, item.FixRequirements.IndexOf(requirement) }); } else if (GameMain.Server != null) { GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.Status }); requirement.Fixed = true; } else { requirement.Fixed = true; } return(true); }