示例#1
0
    public GuiObject BuildHearthFireWindow(HearthFire h)
    {
        GuiObject window = new GuiObject(new Rect(0, 0, 300, 500), "LeftPane", "Hearth Fire");

        window.AddChild(new GuiObject(new Rect(5, 30, 290, 25),
                                      (g) => {
            GUI.Label(g.rect, "Remaining Fuel: ");
            GUI.Box(new Rect(120, 30, 170, 25), "");
            GUI.Box(new Rect(120, 30, 170 * h.currentFuel / h.maxFuel, 25), "");
            GUI.Label(new Rect(120, 30, 240, 25), h.currentFuel + "/" + h.maxFuel);
        }, "FuelCount", ""));

        window.AddChild(new GuiObject(new Rect(5, 65, 290, 30),
                                      (g) => {
            GUI.Box(new Rect(5, 65, 290, 25), "");
            GUI.Box(new Rect(5, 65, (int)(290 * (60f / h.fuelPerMinute - h.timer) / (60f / h.fuelPerMinute)), 25), "");
        }, "Fueltimer", ""));

        Inventory inv = man.GetComponent <Inventory>();

        window.AddChild(new GuiObject(new Rect(5, 100, 290, 400),
                                      (g) => {
            int i = 0;
            int[] currentResources = inv.GetAmounts(h.acceptedFuels);
            foreach (ItemCount rc in h.acceptedFuels)
            {
                GUI.Label(new Rect(5, 90 + i * 25, 290, 25), "Add " + rc.item.name + ", adds " + rc.amount + " fuel");
                if (currentResources[i] < 1 || h.currentFuel >= h.maxFuel)
                {
                    GUI.enabled = false;
                }
                if (GUI.Button(new Rect(220, 90 + i * 25, 40, 25), "Add"))
                {
                    h.AddFuel(rc.item);
                    inv.AddToInventory(rc.item, -1);
                }
                GUI.enabled = true;
                SetColor(() => { return(currentResources[i] > 0); });
                GUI.Label(new Rect(270, 90 + i * 25, 25, 25), "(" + currentResources[i] + ")");
                SetColor();
                i++;
            }
        }, "FuelAdder", ""));

        window.Draw += (g) => {
            GUI.Box(g.rect, g.text);
            if (!Static.Man.AtFire)
            {
                NewWindowTask = CloseWindow;
                NewWindow     = window;
            }
            else
            {
                window.DrawAllChildren();
            }
        };
        return(window);
    }
示例#2
0
    public GuiObject BuildGraphs()
    {
        int       x = 700, y = 0, w = 200, h = 50;
        GuiObject box = new GuiObject(new Rect(x, y, w, h), "GraphsBox", "");

        box.AddChild(new GuiObject(new Rect(0, 0, w / 2 - 2, (h - 5) / 2),
                                   (g) => {
            GUI.Box(g.rect, g.name);
            GUI.Box(new Rect(g.rect.x, g.rect.y, g.rect.width * ((float)man.GetStatus().health / 100.0f), g.rect.height), "");
        },
                                   "HealthBar", "Health"));

        box.AddChild(new GuiObject(new Rect(w / 2 + 3, 0, w / 2 - 2, (h - 5) / 2),
                                   (g) => {
            GUI.Box(g.rect, g.name);
            GUI.Box(new Rect(g.rect.x, g.rect.y, g.rect.width * ((float)man.GetStatus().hunger / 100.0f), g.rect.height), "");
        },
                                   "HungerBar", "Hunger"));

        box.AddChild(new GuiObject(new Rect(0, 5 + (h - 5) / 2, w / 2 - 2, (h - 5) / 2),
                                   (g) => {
            GUI.Box(g.rect, g.name);
            GUI.Box(new Rect(g.rect.x, g.rect.y, g.rect.width * ((float)man.GetStatus().energy / 100.0f), g.rect.height), "");
        },
                                   "EnergyBar", "Energy"));

        box.AddChild(new GuiObject(new Rect(w / 2 + 3, 5 + (h - 5) / 2, w / 2 - 2, (h - 5) / 2),
                                   (g) => {
            GUI.Box(g.rect, g.name);
            GUI.Box(new Rect(g.rect.x, g.rect.y, g.rect.width * ((float)man.GetStatus().thirst / 100.0f), g.rect.height), "");
        },
                                   "ThirstBar", "Thirst"));

        box.Draw += (g) => {
            GUI.Box(g.rect, "");
            g.DrawAllChildren();
        };
        return(box);
    }
示例#3
0
    public GuiObject BuildArmoryWindow(Armory armory)
    {
        GuiObject window = new GuiObject(new Rect(0, 0, 300, 500), "LeftPane", "Armory");

        Func <ItemCount, int, int, int> DrawItemBox = delegate(ItemCount i, int y, int w) {
            GUI.Box(new Rect(5, y, w - 110, 40), i.item.GetName() + " -- " + i.amount);
            GUI.Label(new Rect(10, y + 20, w - 110, 20), i.item.GetDescription());
            if (GUI.Button(new Rect(w - 100, y, 80, 20), "Take"))
            {
                man.GetComponent <Inventory>().AddToInventory(armory.TakeItem(i.item));
            }
            if (i.amount > 1 && GUI.Button(new Rect(w - 100, y + 22, 80, 18), "Take All"))
            {
                man.GetComponent <Inventory>().AddToInventory(armory.TakeItem(i.item, i.amount));
            }
            return(45);
        };

        Vector2 pos = Vector2.zero;

        window.AddChild(new GuiObject(new Rect(5, 25, 290, 470),
                                      (g) => {
            int numItems = armory.GetNumItems();
            pos          = GUI.BeginScrollView(g.rect, pos, new Rect(0, 0, g.rect.width - 20, numItems * 45 + 40));
            int ypos     = 5;

            foreach (var a in armory.armors)
            {
                ypos += DrawItemBox(a, ypos, (int)g.rect.width);
            }
            ypos += 20;
            foreach (var w in armory.weapons)
            {
                ypos += DrawItemBox(w, ypos, (int)g.rect.width);
            }
            ypos += 20;
            foreach (var p in armory.potions)
            {
                ypos += DrawItemBox(p, ypos, (int)g.rect.width);
            }

            GUI.EndScrollView();
        }, "ItemList", ""));

        return(window);
    }
示例#4
0
    public GuiObject BuildCombatWindow(IFightable friend, IFightable enemy, Combat combat)
    {
        CloseWindow("LeftPane");
        GuiObject window = new GuiObject(new Rect(100, 50, 400, 300), "CentrePane", "Combat!");
        Status    friendStatus = friend.GetStatus(), enemyStatus = enemy.GetStatus();

        combat = new Combat(friend, enemy);
        string report = combat.Phase()();

        window.AddChild(new GuiObject(new Rect(10, 25, 490, 370),
                                      (g) => {
            GUI.Label(g.rect, "Night has fallen and you were attacked!\n" + report);
            if (GUI.Button(new Rect(175, 260, 50, 25), "OK"))
            {
                CloseWindow("CentrePane");
            }
        }, "Report", ""));

        return(window);
    }
示例#5
0
	public GuiObject BuildToolBar() {
		int x = 300, y = 0, w = 400, h = 50;
		GuiObject bar = new GuiObject(new Rect(x, y, w, h), "MainToolBar", "");
		
		bar.AddChild(new GuiObject(new Rect(50, 5, 40, 40), 
									(g) => {if (GUI.Button(g.rect, g.text)) {
											NewWindowTask = ToggleWindow;
											NewWindow = BuildDebugWindow();
									}},
									"RightPane", "Debug")); 

		//Time.deltaTime is passed by value in - dis iz broken.
//		bar.AddChild(new GuiObject(new Rect(95, 5, 3f /Time.deltaTime, 40), "FPS", "FPS: " + 1f /Time.deltaTime));
				
		bar.Draw += (g) => {
			GUI.Box(g.rect, g.text);
			g.DrawAllChildren();
		};
		return bar;
	}
示例#6
0
    public GuiObject BuildDebugWindow()
    {
        GuiObject window = new GuiObject(new Rect(750, 50, 270, 400), "RightPane", "Debug");

        window.Draw += (g) => {
            GUI.Box(g.rect, g.text);
            g.DrawAllChildren();
        };

        window.AddChild(new GuiObject(new Rect(5, 20, 270, 400),
                                      (g) => {
            GUI.Box(new Rect(5, 85, 40, 20 + peon.queue.Size() * 20), peon.queue.Size().ToString());
            GUI.Label(g.rect, peon.state.ToString());
            if (GUI.Button(new Rect(5, 40, 40, 40), "Skip"))
            {
                peon.queue.CancelCurrent();
            }
        },
                                      "info", ""));
        return(window);
    }
示例#7
0
    public GuiObject BuildToolBar()
    {
        int       x = 300, y = 0, w = 400, h = 50;
        GuiObject bar = new GuiObject(new Rect(x, y, w, h), "MainToolBar", "");

        bar.AddChild(new GuiObject(new Rect(50, 5, 40, 40),
                                   (g) => { if (GUI.Button(g.rect, g.text))
                                            {
                                                NewWindowTask = ToggleWindow;
                                                NewWindow     = BuildDebugWindow();
                                            }
                                   },
                                   "RightPane", "Debug"));

        //Time.deltaTime is passed by value in - dis iz broken.
//		bar.AddChild(new GuiObject(new Rect(95, 5, 3f /Time.deltaTime, 40), "FPS", "FPS: " + 1f /Time.deltaTime));

        bar.Draw += (g) => {
            GUI.Box(g.rect, g.text);
            g.DrawAllChildren();
        };
        return(bar);
    }
示例#8
0
    public GuiObject BuildCombatDebugWindow(IFightable friend, IFightable enemy, Combat combat)
    {
        CloseWindow("LeftPane");

        GuiObject window = new GuiObject(new Rect(20, 50, 800, 500), "CentrePane", "Combat!");
        Status    friendStatus = friend.GetStatus(), enemyStatus = enemy.GetStatus();

        combat = new Combat(friend, enemy);

        window.AddChild(new GuiObject(new Rect(20, 20, 800, 100),
                                      (g) => {
            GUI.Label(new Rect(10, 25, 780, 100), "Night has fallen, you are under attack!");

            if (GUI.Button(new Rect(345, 65, 100, 30), "Attack!"))
            {
                combat.Phase();
            }
        }, "Text", ""));

        window.AddChild(new GuiObject(new Rect(20, 100, 360, 390),
                                      (g) => {
            GUI.Box(g.rect, g.text);
            GUI.Label(new Rect(30, 200, 200, 25), "Attack: " + friendStatus.attack);
            if (friendStatus.attackbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(90, 200, 200, 25), "+" + friendStatus.attackbonus);
                SetColor();
            }
            GUI.Label(new Rect(30, 220, 200, 25), "Armour: " + friendStatus.armour);
            if (friendStatus.armorbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(90, 220, 200, 25), "+" + friendStatus.armorbonus);
                SetColor();
            }
            GUI.Label(new Rect(30, 240, 200, 25), "Speed: " + friendStatus.speed);
            if (friendStatus.speedbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(90, 240, 200, 25), "+" + friendStatus.speedbonus);
                SetColor();
            }
            GUI.Label(new Rect(130, 200, 100, 25), "Health: " + friendStatus.health);
            GUI.Label(new Rect(130, 220, 100, 25), "Turn: " + friendStatus.turn);
        }, "FriendBox", "Friend"));

        window.AddChild(new GuiObject(new Rect(410, 100, 360, 390),
                                      (g) => {
            GUI.Box(g.rect, g.text);
            GUI.Label(new Rect(420, 200, 200, 25), "Attack: " + enemyStatus.attack);
            if (enemyStatus.attackbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(480, 200, 200, 25), "+" + enemyStatus.attackbonus);
                SetColor();
            }
            GUI.Label(new Rect(420, 220, 200, 25), "Armour: " + enemyStatus.armour);
            if (enemyStatus.armorbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(480, 220, 200, 25), "+" + enemyStatus.armorbonus);
                SetColor();
            }
            GUI.Label(new Rect(420, 240, 200, 25), "Speed: " + enemyStatus.speed);
            if (enemyStatus.speedbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(480, 240, 200, 25), "+" + enemyStatus.speedbonus);
                SetColor();
            }
            GUI.Label(new Rect(520, 200, 100, 25), "Health: " + enemyStatus.health);
            GUI.Label(new Rect(520, 220, 100, 25), "Turn: " + enemyStatus.turn);
        }, "EnemyBox", "Enemy"));

        return(window);
    }
示例#9
0
	public GuiObject BuildGraphs() {
		int x = 700, y = 0, w = 200, h = 50;
		GuiObject box = new GuiObject(new Rect(x, y, w, h), "GraphsBox", "");
		box.AddChild(new GuiObject(new Rect(0, 0 , w / 2-2, (h - 5)/2), 
			(g) => {
				GUI.Box(g.rect, g.name);
				GUI.Box(new Rect(g.rect.x, g.rect.y, g.rect.width * ((float)man.GetStatus().health / 100.0f), g.rect.height), "");
			},
			"HealthBar", "Health")); 
		
		box.AddChild(new GuiObject(new Rect( w / 2 + 3, 0 , w / 2-2, (h - 5)/2), 
			(g) => {
				GUI.Box(g.rect, g.name);
				GUI.Box(new Rect(g.rect.x, g.rect.y, g.rect.width * ((float)man.GetStatus().hunger / 100.0f), g.rect.height), "");
			},
			"HungerBar", "Hunger")); 
		
		box.AddChild(new GuiObject(new Rect(0, 5 + (h - 5)/2, w / 2-2, (h - 5)/2), 
			(g) => {
				GUI.Box(g.rect, g.name);
				GUI.Box(new Rect(g.rect.x, g.rect.y, g.rect.width * ((float)man.GetStatus().energy / 100.0f), g.rect.height), "");
			},
			"EnergyBar", "Energy")); 
		
		box.AddChild(new GuiObject(new Rect(w / 2 + 3, 5 + (h - 5)/2, w / 2-2, (h - 5)/2), 
			(g) => {
				GUI.Box(g.rect, g.name);
				GUI.Box(new Rect(g.rect.x, g.rect.y, g.rect.width * ((float)man.GetStatus().thirst / 100.0f), g.rect.height), "");
			},
			"ThirstBar", "Thirst")); 
		
		box.Draw += (g) => {
			GUI.Box(g.rect, "");
			g.DrawAllChildren();
		};	
		return box;
	}
示例#10
0
	public GuiObject BuildCombatDebugWindow(IFightable friend, IFightable enemy, Combat combat) {
		CloseWindow("LeftPane");
		
		GuiObject window = new GuiObject(new Rect(20, 50, 800, 500), "CentrePane", "Combat!");	
		Status friendStatus = friend.GetStatus(), enemyStatus = enemy.GetStatus();
		combat = new Combat(friend, enemy);
		
		window.AddChild(new GuiObject( new Rect(20, 20, 800, 100),
			(g) => {
				GUI.Label(new Rect(10, 25, 780, 100), "Night has fallen, you are under attack!");
				
				if (GUI.Button(new Rect(345, 65, 100, 30), "Attack!")) {
						combat.Phase();
				}
			}, "Text", ""));
		
		window.AddChild(new GuiObject(new Rect(20, 100, 360, 390),
			(g) => {
				GUI.Box(g.rect, g.text);
				GUI.Label(new Rect(30, 200, 200, 25), "Attack: " + friendStatus.attack);
				if (friendStatus.attackbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(90, 200, 200, 25), "+" + friendStatus.attackbonus);
					SetColor();
				}
				GUI.Label(new Rect(30, 220, 200, 25), "Armour: " + friendStatus.armour);
				if (friendStatus.armorbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(90, 220, 200, 25), "+" + friendStatus.armorbonus);
					SetColor();
				}
				GUI.Label(new Rect(30, 240, 200, 25), "Speed: " + friendStatus.speed);
				if (friendStatus.speedbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(90, 240, 200, 25), "+" + friendStatus.speedbonus);
					SetColor();
				}
				GUI.Label(new Rect(130, 200, 100, 25), "Health: " + friendStatus.health);
				GUI.Label(new Rect(130, 220, 100, 25), "Turn: " + friendStatus.turn);
			}, "FriendBox", "Friend"));
		
		window.AddChild(new GuiObject(new Rect(410, 100, 360, 390),
			(g) => {
				GUI.Box(g.rect, g.text);
				GUI.Label(new Rect(420, 200, 200, 25), "Attack: " + enemyStatus.attack);
				if (enemyStatus.attackbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(480, 200, 200, 25), "+" + enemyStatus.attackbonus);
					SetColor();
				}
				GUI.Label(new Rect(420, 220, 200, 25), "Armour: " + enemyStatus.armour);
				if (enemyStatus.armorbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(480, 220, 200, 25), "+" + enemyStatus.armorbonus);
					SetColor();
				}
				GUI.Label(new Rect(420, 240, 200, 25), "Speed: " + enemyStatus.speed);
				if (enemyStatus.speedbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(480, 240, 200, 25), "+" + enemyStatus.speedbonus);
					SetColor();
				}
				GUI.Label(new Rect(520, 200, 100, 25), "Health: " + enemyStatus.health);
				GUI.Label(new Rect(520, 220, 100, 25), "Turn: " + enemyStatus.turn);
			}, "EnemyBox", "Enemy"));
		
		return window;
	}
示例#11
0
	public GuiObject BuildCombatWindow(IFightable friend, IFightable enemy, Combat combat) {
		CloseWindow("LeftPane");
		GuiObject window = new GuiObject(new Rect(100, 50, 400, 300), "CentrePane", "Combat!");
		Status friendStatus = friend.GetStatus(), enemyStatus = enemy.GetStatus();
		combat = new Combat(friend, enemy);
		string report = combat.Phase()();
		
		window.AddChild(new GuiObject(new Rect(10, 25, 490, 370),
			(g) => {
				GUI.Label(g.rect, "Night has fallen and you were attacked!\n" + report);
				if (GUI.Button(new Rect(175, 260, 50, 25), "OK")) {
					CloseWindow("CentrePane");
				}
			}, "Report", ""));
		
		return window;
	}
示例#12
0
	public GuiObject BuildArmoryWindow(Armory armory) {
		GuiObject window = new GuiObject(new Rect(0, 0, 300, 500), "LeftPane", "Armory");	
		
		Func<ItemCount, int, int, int> DrawItemBox = delegate(ItemCount i, int y, int w) {
			GUI.Box(new Rect(5, y, w - 110, 40), i.item.GetName() + " -- " + i.amount);
			GUI.Label(new Rect(10, y + 20, w - 110, 20), i.item.GetDescription());
			if (GUI.Button(new Rect(w - 100, y, 80, 20), "Take")) {
				man.GetComponent<Inventory>().AddToInventory(armory.TakeItem(i.item));
			}
			if (i.amount > 1 && GUI.Button(new Rect(w - 100, y + 22, 80, 18), "Take All")) {
				man.GetComponent<Inventory>().AddToInventory(armory.TakeItem(i.item, i.amount));
			}
			return 45;
		};
		
		Vector2 pos = Vector2.zero;
		window.AddChild(new GuiObject(new Rect(5, 25, 290, 470),
			(g) => {
				int numItems = armory.GetNumItems();
				pos = GUI.BeginScrollView(g.rect, pos, new Rect(0, 0, g.rect.width - 20, numItems * 45 + 40));
				int ypos = 5;
				
				foreach (var a in armory.armors) {
					ypos += DrawItemBox(a, ypos, (int)g.rect.width);
				}
				ypos += 20;
				foreach (var w in armory.weapons) {
					ypos += DrawItemBox(w, ypos, (int)g.rect.width);
				}
				ypos += 20;
				foreach (var p in armory.potions) {
					ypos += DrawItemBox(p, ypos, (int)g.rect.width);
				}
			
				GUI.EndScrollView();
				
			}, "ItemList", ""));
		
		return window;
	}
示例#13
0
	public GuiObject BuildHearthFireWindow(HearthFire h) {
		GuiObject window = new GuiObject(new Rect(0, 0, 300, 500), "LeftPane", "Hearth Fire");
		
		window.AddChild(new GuiObject(new Rect(5, 30, 290, 25),
			(g) => {
				GUI.Label(g.rect, "Remaining Fuel: ");
				GUI.Box(new Rect(120, 30, 170, 25), "");
				GUI.Box(new Rect(120, 30, 170 * h.currentFuel / h.maxFuel, 25), "");
				GUI.Label(new Rect(120, 30, 240, 25), h.currentFuel + "/" + h.maxFuel);
			}, "FuelCount", ""));
		
		window.AddChild(new GuiObject(new Rect(5, 65, 290, 30),
			(g) => {
				GUI.Box(new Rect(5, 65, 290, 25), "");
				GUI.Box(new Rect(5, 65, (int)(290 * (60f / h.fuelPerMinute - h.timer)/(60f/h.fuelPerMinute)), 25), "");
			}, "Fueltimer", ""));
		
		Inventory inv = man.GetComponent<Inventory>();
		window.AddChild(new GuiObject(new Rect(5, 100, 290, 400), 
			(g) => {
				int i = 0;
				int[] currentResources = inv.GetAmounts(h.acceptedFuels);
				foreach (ItemCount rc in h.acceptedFuels) {					
					GUI.Label(new Rect(5, 90 + i * 25, 290, 25), "Add " + rc.item.name + ", adds " + rc.amount + " fuel");
					if (currentResources[i] < 1 || h.currentFuel >= h.maxFuel) GUI.enabled = false; 
					if (GUI.Button(new Rect(220, 90 + i * 25, 40, 25), "Add")) {
						h.AddFuel(rc.item);
						inv.AddToInventory(rc.item, -1);
					}
					GUI.enabled = true;
					SetColor(() => {return currentResources[i] > 0;});
					GUI.Label(new Rect(270, 90 + i * 25, 25, 25), "(" + currentResources[i] + ")");
					SetColor();
					i++;
				}
			
			}, "FuelAdder", ""));
			
		window.Draw += (g) => {
			GUI.Box(g.rect, g.text);
			if (!Static.Man.AtFire){
				NewWindowTask=CloseWindow;
				NewWindow=window;
			}else
				window.DrawAllChildren();
		};
		return window;
	}
示例#14
0
	public GuiObject BuildDebugWindow() {
		GuiObject window = new GuiObject(new Rect(750, 50, 270, 400), "RightPane", "Debug");
		
		window.Draw += (g) => {
			GUI.Box(g.rect, g.text);
			g.DrawAllChildren();
		};
		
		window.AddChild(new GuiObject(new Rect(5, 20, 270, 400), 
			(g) => {
				GUI.Box(new Rect(5, 85, 40, 20 + peon.queue.Size() * 20), peon.queue.Size().ToString());
				GUI.Label(g.rect, peon.state.ToString());
				if (GUI.Button(new Rect(5, 40, 40, 40), "Skip")) {
					peon.queue.CancelCurrent();
				}
			},
			"info", ""));
		return window;
	}