private GUI.Frame CreatePanicFrame() { var frame = new GUI.Frame(UIParent); frame.SetTexture("images/GUI/unit_background"); frame.Color = Color.Black; frame.Width = 164; frame.Height = 19; frame.OnClick += delegate(Frame frame1, GUIManager.MouseEventArgs args) { DynamicGroupManager.Group group = (DynamicGroupManager.Group)frame1["group"]; if (group != null) { group.Panic += 5; } }; var panicBarBg = new GUI.Frame(frame); panicBarBg.SetTexture("images/GUI/health_background"); panicBarBg.Width = 136; panicBarBg.Height = 13; panicBarBg.X = 3; panicBarBg.Y = 3; frame["panicBarBg"] = panicBarBg; var panicBar = new GUI.Frame(panicBarBg); panicBar.SetTexture("images/GUI/bar_solid"); panicBar.Color = new Color(87, 55, 253); panicBar.Width = (int)(panicBarBg.Width * 0.5); panicBar.Height = 11; panicBar.X = 1; panicBar.Y = 1; frame["panicBar"] = panicBar; var text = new GUI.Text(frame); text.SetFont("fonts/UnitName"); text.Value = "0%"; text.X = 4; text.Y = 1; frame["text"] = text; return(frame); }
private GUI.Frame CreateUnitFrame(Soldier soldier) { var frame = new GUI.Frame(UIParent); frame.SetTexture("images/GUI/unit_background"); frame.Color = Color.Black; frame.Width = 164; frame.Height = 42; var nameText = new GUI.Text(frame); nameText.SetFont("fonts/UnitName"); nameText.Value = soldier.Name + " " /* + soldier.GetHashCode()*/; nameText.X = 4; nameText.Y = 1; frame["nameText"] = nameText; var healthBarBg = new GUI.Frame(frame); healthBarBg.SetTexture("images/GUI/health_background"); healthBarBg.Width = 136; healthBarBg.Height = 13; healthBarBg.X = 3; healthBarBg.Y = 19; frame["healthBarBg"] = healthBarBg; var healthBar = new GUI.Frame(healthBarBg); healthBar.SetTexture("images/GUI/bar_solid"); healthBar.Color = Color.Red; healthBar.Width = (int)((healthBarBg.Width - 2) * (soldier.GetComponent <Component.Stat>().HP / soldier.GetComponent <Component.Stat>().MaxHP)); healthBar.Height = 11; healthBar.X = 1; healthBar.Y = 1; frame["healthBar"] = healthBar; var actionBarBg = new GUI.Frame(frame); actionBarBg.SetTexture("images/GUI/health_background"); actionBarBg.Width = 136; actionBarBg.Height = 8; actionBarBg.X = 3; actionBarBg.Y = 31; frame["actionBarBg"] = actionBarBg; var actionBar = new GUI.Frame(actionBarBg); actionBar.SetTexture("images/GUI/bar_solid"); actionBar.Color = Color.Orange; actionBar.Width = (int)((healthBarBg.Width - 2) * (soldier.GetComponent <Component.Stat>().HP / soldier.GetComponent <Component.Stat>().MaxHP)); actionBar.Height = 6; actionBar.X = 1; actionBar.Y = 1; frame["actionBar"] = actionBar; for (int i = 1; i < 10; i++) { var line = new GUI.Frame(actionBar); line.Texture = Utility.GetSolidTexture(); line.Color = Color.Black; line.Height = 6; line.Width = 1; line.X = (int)(i * ((float)actionBarBg.Width / 10f)) - 1; } return(frame); }
private GUI.Frame CreateUnitFrame(Soldier soldier) { var frame = new GUI.Frame(UIParent); frame.SetTexture("images/GUI/unit_background"); frame.Color = Color.Black; frame.Width = 164; frame.Height = 42; var nameText = new GUI.Text(frame); nameText.SetFont("fonts/UnitName"); nameText.Value = soldier.Name + " "/* + soldier.GetHashCode()*/; nameText.X = 4; nameText.Y = 1; frame["nameText"] = nameText; var healthBarBg = new GUI.Frame(frame); healthBarBg.SetTexture("images/GUI/health_background"); healthBarBg.Width = 136; healthBarBg.Height = 13; healthBarBg.X = 3; healthBarBg.Y = 19; frame["healthBarBg"] = healthBarBg; var healthBar = new GUI.Frame(healthBarBg); healthBar.SetTexture("images/GUI/bar_solid"); healthBar.Color = Color.Red; healthBar.Width = (int)((healthBarBg.Width - 2) * (soldier.GetComponent<Component.Stat>().HP / soldier.GetComponent<Component.Stat>().MaxHP)); healthBar.Height = 11; healthBar.X = 1; healthBar.Y = 1; frame["healthBar"] = healthBar; var actionBarBg = new GUI.Frame(frame); actionBarBg.SetTexture("images/GUI/health_background"); actionBarBg.Width = 136; actionBarBg.Height = 8; actionBarBg.X = 3; actionBarBg.Y = 31; frame["actionBarBg"] = actionBarBg; var actionBar = new GUI.Frame(actionBarBg); actionBar.SetTexture("images/GUI/bar_solid"); actionBar.Color = Color.Orange; actionBar.Width = (int)((healthBarBg.Width - 2) * (soldier.GetComponent<Component.Stat>().HP / soldier.GetComponent<Component.Stat>().MaxHP)); actionBar.Height = 6; actionBar.X = 1; actionBar.Y = 1; frame["actionBar"] = actionBar; for (int i = 1; i < 10; i++) { var line = new GUI.Frame(actionBar); line.Texture = Utility.GetSolidTexture(); line.Color = Color.Black; line.Height = 6; line.Width = 1; line.X = (int)(i * ((float)actionBarBg.Width/10f)) - 1; } return frame; }
private GUI.Frame CreatePanicFrame() { var frame = new GUI.Frame(UIParent); frame.SetTexture("images/GUI/unit_background"); frame.Color = Color.Black; frame.Width = 164; frame.Height = 19; frame.OnClick += delegate(Frame frame1, GUIManager.MouseEventArgs args) { DynamicGroupManager.Group group = (DynamicGroupManager.Group)frame1["group"]; if (group != null) group.Panic += 5; }; var panicBarBg = new GUI.Frame(frame); panicBarBg.SetTexture("images/GUI/health_background"); panicBarBg.Width = 136; panicBarBg.Height = 13; panicBarBg.X = 3; panicBarBg.Y = 3; frame["panicBarBg"] = panicBarBg; var panicBar = new GUI.Frame(panicBarBg); panicBar.SetTexture("images/GUI/bar_solid"); panicBar.Color = new Color(87, 55, 253); panicBar.Width = (int)(panicBarBg.Width * 0.5); panicBar.Height = 11; panicBar.X = 1; panicBar.Y = 1; frame["panicBar"] = panicBar; var text = new GUI.Text(frame); text.SetFont("fonts/UnitName"); text.Value = "0%"; text.X = 4; text.Y = 1; frame["text"] = text; return frame; }