void Start() { if(!DataKeeper.dk.randomMsgsEnabled){ CheckStraightPosition script = rightTrigger.GetComponent<CheckStraightPosition>(); script.enabled = false; } // This process is used to start an Android app on a smartphone connected via USB. //The app is used to distract the drivers from the driving task, forcing a lane departure. //The paths need to be set in order for this code to work. //Also, the "process.Start()" call needs to be uncommented, at the bottom of this class. process = new System.Diagnostics.Process(); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.CreateNoWindow = true; if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor){ process.StartInfo.FileName = pcADBfilePath; } else if(Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor){ process.StartInfo.FileName = macADBfilePath; } process.StartInfo.Arguments = androidAppName; guiScript = GetComponent<GUIHandler>(); }
public GUI(RenderContext rc) { //Basic Init _fontSmall = rc.LoadFont("Assets/Cabin.ttf", 12); _fontMedium = rc.LoadFont("Assets/Cabin.ttf", 18); _fontBig = rc.LoadFont("Assets/Cabin.ttf", 40); _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(rc); //Start Pannel Init _guiPanel = new GUIPanel("PhysicsTest", _fontMedium, 10, 10, 330, 250); _info1 = new GUIText("Über die Tasten des Nummernblocks " , _fontMedium, 30, 170, _color2); _info2 = new GUIText("(1-4) kann zwischen 4 verschiedenen ", _fontMedium, 30, 190, _color2); _info3 = new GUIText("Szenen gewechselt werden", _fontMedium, 30, 210, _color2); _fps = new GUIText("FPS", _fontMedium, 30, 55, _color2); _numberRb = new GUIText("Rigidbodies: ", _fontMedium, 30, 85, _color2); _shapeType = new GUIText("Collision Shapes: ", _fontMedium, 30, 115, _color2); _shapes = new GUIText("", _fontMedium, 50, 135, _color2); _guiPanel.ChildElements.Add(_info1); _guiPanel.ChildElements.Add(_info2); _guiPanel.ChildElements.Add(_info3); _guiPanel.ChildElements.Add(_fps); _guiPanel.ChildElements.Add(_numberRb); _guiPanel.ChildElements.Add(_shapeType); _guiPanel.ChildElements.Add(_shapes); ShowGUI(); }
private static void GameLoop() { var Window = WindowHandler.Initialize(); var GUI = GUIHandler.Initialize(); var Clock = new Clock(); new BasicScene(); while (Window.IsOpen) { Window.DispatchEvents(); Window.Clear(); WorldCollision.CheckCollision(); World.UpdateEntities(); GlobalConsole.DrawConsole(); DrawableHandler.Draw(); InputHandler.UpdateInputs(); GUI.Draw(); Window.Display(); var DeltaClock = Clock.Restart(); deltaTime = DeltaClock.AsSeconds(); } }
// is called on startup public override void Init() { RC.ClearColor = new float4(0.1f, 0.1f, 0.5f, 1); // IMPORTANT: You are supposed to use either one SetWindowSize() or VideoWall(). You can't use both. // It's possible to resize a window to fit on a video wall or display. // Here are some different variants how to use this functionality. Uncomment to test. //SetWindowSize(800, 600); SetWindowSize(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height/9 * 2, true, 0, 0); //SetWindowSize(Screen.PrimaryScreen.Bounds.Width/9 * 2, Screen.PrimaryScreen.Bounds.Height, true, 0, 0); //SetWindowSize(640, 480, false, Screen.PrimaryScreen.Bounds.Width/2 - 640/2, Screen.PrimaryScreen.Bounds.Height/2 - 480/2); // IMPORTANT: For video Walls or projector matrices it's possible to let the system do the magic by // giving it the number of monitors/projectors per axis and specify some border information. // This only works in pseudo-fullscreen mode a.k.a borderless fullscreen-window. //VideoWall(0, 0, true, false); // This is the old method. More than this could not be done directly in a project code(?) //Width = 640; //Height = 480; // Initialize an ui. _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); // Create a new element. GUIElement element = new GUIImage("Assets/image.png", 0, 0, -10, 320, 130); // Add the element to the gui. _guiHandler.Add(element); // Add something to render. _cube = new Cube(); _spcolor = MoreShaders.GetDiffuseColorShader(RC); _colorParam = _spcolor.GetShaderParam("color"); }
public GUI(RenderContext rc) { //Basic Init _fontSmall = rc.LoadFont("Assets/Cabin.ttf", 12); _fontMedium = rc.LoadFont("Assets/Cabin.ttf", 18); _fontBig = rc.LoadFont("Assets/Cabin.ttf", 40); _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(rc); //Start Pannel Init _guiPanel = new GUIPanel("PhysicsTest", _fontMedium, 10, 10, 330, 250); _info1 = new GUIText("Use NumPad keys 1..4", _fontMedium, 30, 170, _color2); _info2 = new GUIText("to switch between 4 ", _fontMedium, 30, 190, _color2); _info3 = new GUIText("different test scenes.", _fontMedium, 30, 210, _color2); _fps = new GUIText("FPS", _fontMedium, 30, 55, _color2); _numberRb = new GUIText("Rigidbodies: ", _fontMedium, 30, 85, _color2); _shapeType = new GUIText("Collision Shapes: ", _fontMedium, 30, 115, _color2); _shapes = new GUIText("", _fontMedium, 50, 135, _color2); _guiPanel.ChildElements.Add(_info1); _guiPanel.ChildElements.Add(_info2); _guiPanel.ChildElements.Add(_info3); _guiPanel.ChildElements.Add(_fps); _guiPanel.ChildElements.Add(_numberRb); _guiPanel.ChildElements.Add(_shapeType); _guiPanel.ChildElements.Add(_shapes); ShowGUI(); }
void Awake() { Instance = this; PropertyLists = new List <GameObject> (); m_iconList = new Dictionary <string, GameObject>(); m_actionTextList = new List <UIActionText> (); }
// Start is called before the first frame update void Start() { _controller = this.GetComponent <CharacterController>(); cam = transform.Find("Camera").GetComponent <Camera>(); uiHandler = ui.GetComponent <GUIHandler>(); state = PlayerState.Normal; }
// Init is called on startup. public override void Init() { #if GUI_SIMPLE _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); _guiFuseeLink = new GUIButton(6, 6, 157, 87); _guiFuseeLink.ButtonColor = new float4(0, 0, 0, 0); _guiFuseeLink.BorderColor = new float4(0, 0.6f, 0.2f, 1); _guiFuseeLink.BorderWidth = 0; _guiFuseeLink.OnGUIButtonDown += _guiFuseeLink_OnGUIButtonDown; _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter; _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave; _guiHandler.Add(_guiFuseeLink); _guiFuseeLogo = new GUIImage(AssetStorage.Get <ImageData>("FuseeLogo150.png"), 10, 10, -5, 150, 80); _guiHandler.Add(_guiFuseeLogo); var fontLato = AssetStorage.Get <Font>("Lato-Black.ttf"); fontLato.UseKerning = true; _guiLatoBlack = new FontMap(fontLato, 18); _guiSubText = new GUIText("Simple FUSEE Example", _guiLatoBlack, 100, 100); _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f); _guiHandler.Add(_guiSubText); _subtextWidth = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack); _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack); #endif // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); // Load the rocket model _rocketScene = AssetStorage.Get <SceneContainer>("RocketModel.fus"); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRenderer(_rocketScene); }
public PrintAction(string printMe, int duration) { interactionManager = GameObject.Find("InteractionManager"); guiHandler = interactionManager.GetComponent <GUIHandler> (); timeToStop = duration; toPrint = printMe; }
// is called on startup public override void Init() { RC.ClearColor = new float4(0.1f, 0.1f, 0.5f, 1); // IMPORTANT: You are supposed to use either one SetWindowSize() or VideoWall(). You can't use both. // It's possible to resize a window to fit on a video wall or display. // Here are some different variants how to use this functionality. Uncomment to test. //SetWindowSize(800, 600); //SetWindowSize(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height/5 * 2, true, 0, 0); //SetWindowSize(Screen.PrimaryScreen.Bounds.Width/9 * 2, Screen.PrimaryScreen.Bounds.Height, true, 0, 0); //SetWindowSize(640, 480, false, Screen.PrimaryScreen.Bounds.Width/2 - 640/2, Screen.PrimaryScreen.Bounds.Height/2 - 480/2); // IMPORTANT: For video Walls or projector matrices it's possible to let the system do the magic by // giving it the number of monitors/projectors per axis and specify some border information. // This only works in pseudo-fullscreen mode a.k.a borderless fullscreen-window. VideoWall(0, 0, true, true); // This is the old method. More than this could not be done directly in a project code(?) //Width = 640; //Height = 480; // Initialize an ui. _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); // Create a new element. GUIElement element = new GUIImage("Assets/image.png", 0, 0, -10, 320, 130); // Add the element to the gui. _guiHandler.Add(element); // Add something to render. _cube = new Cube(); _spcolor = Shaders.GetDiffuseColorShader(RC); _colorParam = _spcolor.GetShaderParam("color"); }
// is called on startup public override void Init() { //TestSerialize(); //TestDeserialize(); // GUI initialization _zVal = 500; _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); _guiFuseeLink = new GUIButton(6, 6, 157, 87); _guiFuseeLink.ButtonColor = new float4(0, 0, 0, 0); _guiFuseeLink.BorderColor = new float4(0, 0.6f, 0.2f, 1); _guiFuseeLink.BorderWidth = 0; _guiFuseeLink.OnGUIButtonDown += _guiFuseeLink_OnGUIButtonDown; _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter; _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave; _guiHandler.Add(_guiFuseeLink); _guiFuseeLogo = new GUIImage("Assets/FuseeLogo150.png", 10, 10, -5, 150, 80); _guiHandler.Add(_guiFuseeLogo); _guiLatoBlack = RC.LoadFont("Assets/Lato-Black.ttf", 14); _guiSubText = new GUIText("FUSEE 3D Scene Viewer", _guiLatoBlack, 100, 100); _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f); _guiHandler.Add(_guiSubText); // Scene loading SceneContainer scene; var ser = new Serializer(); using (var file = File.OpenRead(@"Assets/Model.fus")) { scene = ser.Deserialize(file, null, typeof(SceneContainer)) as SceneContainer; } _sr = new SceneRenderer(scene, "Assets"); AdjustModelScaleOffset(); _guiSubText.Text = "FUSEE 3D Scene"; if (scene.Header.CreatedBy != null || scene.Header.CreationDate != null) { _guiSubText.Text += " created"; if (scene.Header.CreatedBy != null) { _guiSubText.Text += " by " + scene.Header.CreatedBy; } if (scene.Header.CreationDate != null) { _guiSubText.Text += " on " + scene.Header.CreationDate; } } _subtextWidth = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack); _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack); _sColor = MoreShaders.GetDiffuseColorShader(RC); RC.SetShader(_sColor); _colorParam = _sColor.GetShaderParam("color"); RC.SetShaderParam(_colorParam, new float4(1, 1, 1, 1)); RC.ClearColor = new float4(1, 1, 1, 1); }
public static void Main(string[] args) { var l = new GUIHandler(); l.Add(new GUIElement()); l.Add(new GUIElement()); Console.WriteLine(l.Count); }
void Awake() { agent = GetComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); currentDestination = 0; currentState = EnemyState.Patrouille; uiHandler = ui.GetComponent <GUIHandler>(); }
/// <summary> /// Start() /// Used for initialization /// </summary> void Start() { shipMovement = ship.GetComponent <ShipMovement>(); shipShooting = ship.GetComponent <ShipShooting>(); shipInfo = ship.GetComponent <ShipInfo>(); guiHandler = GetComponent <GUIHandler>(); asteroidSpawner = GetComponent <AsteroidSpawner>(); }
// Use this for initialization void Start() { eventHandler = GameObject.Find("EventHandler").GetComponent <EventHandler>(); currPlayerPosition = new Vector3(); currPlayerRotation = new Quaternion(); interactionManager = GameObject.Find("InteractionManager"); guiHandler = interactionManager.GetComponent <GUIHandler> (); }
/// <summary> /// Start() /// Used for initialization /// </summary> void Start() { playerData = GetComponent <PlayerData>(); shipInfo = ship.GetComponent <ShipInfo>(); spawner = GetComponent <AsteroidSpawner>(); guiHandler = GetComponent <GUIHandler>(); inputHandler = GetComponent <InputHandler>(); }
public void TestHandler() { var handler = new GUIHandler(); handler.AddAthlete(new Athlete(3)); Assert.AreEqual(handler.subjects[0].BibNumber, 3); }
public OpenAction(GameObject who, GameObject closed, GameObject open) { this.closed = closed; this.open = open; this.who = who; interactionManager = GameObject.Find("InteractionManager"); guiHandler = interactionManager.GetComponent <GUIHandler> (); }
// Init is called on startup. public override void Init() { #if GUI_SIMPLE _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); _guiFuseeLink = new GUIButton(6, 6, 157, 87); _guiFuseeLink.ButtonColor = new float4(0, 0, 0, 0); _guiFuseeLink.BorderColor = new float4(0, 0.6f, 0.2f, 1); _guiFuseeLink.BorderWidth = 0; _guiFuseeLink.OnGUIButtonDown += _guiFuseeLink_OnGUIButtonDown; _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter; _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave; _guiHandler.Add(_guiFuseeLink); _guiFuseeLogo = new GUIImage(AssetStorage.Get <ImageData>("FuseeLogo150.png"), 10, 10, -5, 150, 80); _guiHandler.Add(_guiFuseeLogo); var fontLato = AssetStorage.Get <Font>("Lato-Black.ttf"); fontLato.UseKerning = true; _guiLatoBlack = new FontMap(fontLato, 18); _guiSubText = new GUIText("FUSEE Example", _guiLatoBlack, 100, 100); _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f); _guiHandler.Add(_guiSubText); _subtextWidth = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack); _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack); #endif // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); // Load the rocket model _rocketScene = AssetStorage.Get <SceneContainer>("RocketModel.fus"); //Create StereoCam for S3D rendering _stereoCam = new StereoCameraRig(Stereo3DMode.Anaglyph, Width, Height, 6.5f); _stereoCam.AttachToContext(RC); //Create ScreenS3DTextures object holding the 4 textures to be used with the ScreenS3D object ScreenS3DTextures screenTex = new ScreenS3DTextures(); screenTex.Left = RC.CreateTexture(AssetStorage.Get <ImageData>("left.png")); screenTex.LeftDepth = RC.CreateTexture(AssetStorage.Get <ImageData>("depthLeft.png")); screenTex.Right = RC.CreateTexture(AssetStorage.Get <ImageData>("right.png")); screenTex.RightDepth = RC.CreateTexture(AssetStorage.Get <ImageData>("depthRight.png")); //Create ScreenS3D Object using the ScreenS3Dtextures object from above _screen = new ScreenS3D(RC, screenTex); //Set the config fort the Screen objet. This can also be doene using a whole ScreenConfig object and assiging direktly to the ScreenS3D object _screen.Config.ScaleSize = 1000; _screen.Config.ScaleDepth = 5; _screen.Config.Transform = float4x4.CreateTranslation(0, 200, 0); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRenderer(_rocketScene); // vl = AssetStorage.Get<VideoStream>("left.mkv"); capL = new Capture("Assets/left.mkv"); capLD = new Capture("Assets/depthLeft.mkv"); capR = new Capture("Assets/right.mkv"); capRD = new Capture("Assets/depthRight.mkv"); }
public ChoiceAction(GameObject Player, string mode, EnterScript[] triggers, string indicator, int numChoices, bool second, string message) { manager = GameObject.Find("MissionManager").GetComponent <MissionManager>(); currentMission = manager.getCurrentMission(); //Debug.Log ("Manager found"); this.Player = Player; this.mode = mode; this.indicator = indicator; this.choices = numChoices; this.secondChoice = second; this.text = message; interactionManager = GameObject.Find("InteractionManager"); guiHandler = interactionManager.GetComponent <GUIHandler> (); if (mode.Equals("Trigger")) { this.triggers = triggers; for (int i = 0; i < triggers.Length; i++) { triggers[i].setWillEnter(Player); //Debug.Log(triggers[i] + " set."); } } if (mode.Equals("Button")) { buttons = new KeyCode[numChoices]; if (numChoices == 2) { this.buttons [0] = KeyCode.Alpha0; this.buttons [1] = KeyCode.Alpha1; } else if (numChoices == 3) { this.buttons[0] = KeyCode.Alpha0; this.buttons[1] = KeyCode.Alpha1; this.buttons[2] = KeyCode.Alpha2; } if (indicator.Equals("TavernAfter")) { this.buttonScript = this.manager.tavernRainButton; } else if (indicator.Equals("TavernSupply")) { this.buttonScript = this.manager.tavernSupplyButton; } else if (indicator.Equals("Water")) { this.buttonScript = this.manager.injuredPersonButton; } else if (indicator.Equals("Water2")) { this.buttonScript = this.manager.water2Button; } else if (indicator.Equals("Boat")) { this.buttonScript = this.manager.boatButton; } } }
private void OnSceneLoad_Test() { //ResourceManager.LoadResource<string, TextLoadingParameters>("res_str_test_0", new TextLoadingParameters(new[] { "res_str_test_0.txt" }, Encoding.UTF8), 1, false); //if (!ResourceManager.TryGetResource("res_str_test_0", out string str, true)) // Log.WriteLine("Could not get resource 'res_str_test_0'", LogType.Message); ResourceManager.LoadResource <ITexture, TextureLoadingParameters>("res_tex_test_0", new TextureLoadingParameters(new[] { "res_tex_test_0.png" }, TextureWrapMode.ClampToEdge, TextureFilterMode.Nearest), 2, false); ResourceManager.LoadResource <ITexture, TextureLoadingParameters>("res_tex_test_1", new TextureLoadingParameters(new[] { "res_tex_test_1.png" }, TextureWrapMode.ClampToEdge, TextureFilterMode.Nearest), 2, false); ResourceManager.LoadResource <ITexture, TextureLoadingParameters>("res_tex_test_2", new TextureLoadingParameters(new[] { "res_tex_micha.png" }, TextureWrapMode.ClampToEdge, TextureFilterMode.Nearest), 2, false); ResourceManager.LoadResource <ITextureAtlas, FontLoadingParameters>($"font_Consolas_16", new FontLoadingParameters(new FontFamily("Consolas"), 16), 0, true); if (!ResourceManager.TryGetResource("res_tex_test_0", out ITexture tex0, true)) { Log.WriteLine("Could not get resource 'res_tex_test_0'", LogType.Message); } if (!ResourceManager.TryGetResource("res_tex_test_1", out ITexture tex1, true)) { Log.WriteLine("Could not get resource 'res_tex_test_1'", LogType.Message); } if (!ResourceManager.TryGetResource("res_tex_test_2", out ITexture tex2, true)) { Log.WriteLine("Could not get resource 'res_tex_test_2'", LogType.Message); } IGameObject go_viewport = Scene.CreateGameObject("go_viewport"); Viewport viewport = go_viewport.AddComponent <Viewport>(); //viewport.Transform.Position = new Vector2(1, 0); Scene.MainViewport = viewport; viewport.Zoom = 1; //viewport.Width *= 10f; //viewport.Height *= 10f; //viewport.Transform.Position.x += 1; GUIHandler guiHandler = go_viewport.AddComponent <GUIHandler>(); ResourceManager.TryGetResource("internal_circleShader", out IShader shader, true); //IGameObject go_sprite = Scene.CreateGameObject("go_sprite"); //go_sprite.Transform.Z = 0.65f; //Sprite sprite = go_sprite.AddComponent<Sprite>(); //sprite.Transform.Scale = new Vector2(0.95f, 0.95f); //sprite.Color = new Color(255, 0, 255, 63); IGameObject go_cSprite = Scene.CreateGameObject("go_cSprite"); go_cSprite.Transform.Z = 0.65f; // uniforms Color cSpriteColor = Color.WHITE; float innerRadius = 0.1f; float startAngle = 0.0f; float sweepAngle = 1f; // vertex attributes (VertexAttribute va, float[][] data)[] vertexAttributes =
void OnTriggerEnter(Collider collider) { if (collider.gameObject.tag == "Player") { // Notify GUI that Player won GameObject canvas = GameObject.FindGameObjectWithTag("Canvas"); GUIHandler guiHandlerScript = canvas.GetComponent <GUIHandler>(); guiHandlerScript.YouWin(); } }
private void InitReferences() { if (player == null) { guiHandler = GetComponent <GUIHandler>(); player = GameObject.FindGameObjectWithTag("Player"); playerState = player.GetComponent <PlayerState>(); playerLook = player.transform.Find("PlayerCamera").gameObject.GetComponent <PlayerLook>(); } }
public void shipSelected(LoadedShip ship) { Debug.Log("Custom event triggered!"); GUIHandler guiHandler = new GUIHandler(); MatchDatas.getPlayers()[MatchDatas.getActivePlayerIndex()].setActiveShip(ship); guiHandler.showActiveShipsCard(ship); }
public void Init() { if (Main.netMode != NetmodeID.Server && player.whoAmI == Main.myPlayer) { guiHandler = new GUIHandler(); } inventory = new InventoryHandler(this); initialized = true; }
public DropAction(GameObject who, GrabMe.kind what) { this.who = who; if (who.GetComponent <CharacterOurs> () != null) { whoIs = who.GetComponent <CharacterOurs> (); } this.what = what; interactionManager = GameObject.Find("InteractionManager"); guiHandler = interactionManager.GetComponent <GUIHandler> (); }
void ExitMenu() { GUIHandler.UpdateAbility(m_propMenus[0].propertyList, new List <Ability>(), m_propMenus[1].propertyList); if (m_currentGhost != null) { Destroy(m_currentGhost); } exiting = true; m_selectedButton = null; PauseGame.CanPause = true; }
//toEnter must have an EnterScript on it! public EnterAction(GameObject willEnter, GameObject toEnter, string text) { this.willEnter = willEnter; this.toEnter = toEnter; this.collisionScript = toEnter.GetComponent <EnterScript> (); //this.collisionScript.setWillEnter(willEnter); this.character = willEnter.GetComponent <CharacterOurs> (); interactionManager = GameObject.Find("InteractionManager"); guiHandler = interactionManager.GetComponent <GUIHandler> (); this.text = text; }
void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } PropertyLists = new List <GameObject> (); m_iconList = new Dictionary <string, GameObject>(); }
private void Awake() { player = this.gameObject; GameObject gh = GameObject.Find("GameHandler"); cam = transform.Find("PlayerCamera").gameObject.GetComponent <Camera>(); gameHandler = gh.GetComponent <GameHandler>(); guiHandler = gh.GetComponent <GUIHandler>(); dialogHandler = gh.GetComponent <DialogHandler>(); crosshair = GameObject.Find("Crosshair").GetComponent <Image>(); crosshair.sprite = crosshairImage[0]; inventory = GetComponent <Inventory>(); }
public void RunTests() { GUIHandler handler = new GUIHandler(); handler.AddAthlete(new Athlete(4)); var finished = new FinishedUpdate(); handler.updateObservers(finished); Athlete temp = (Athlete)handler.subjects[0]; Assert.AreEqual(temp.observers.Count, 1); }
public static void Main(string[] args) { handler = new GUIHandler(); //Thread t = new Thread(handler.ShowControlForm); //handler.ShowControlForm(); SimulatorController controller = new SimulatorController(handler); Thread t = new Thread(() => controller.Run("Data/Short Race Simulation-01.csv")); t.Start(); //controller.Run("Data/Short Race Simulation-01.csv"); handler.ShowControlForm(); }
private int[] scoreBoard; // holds the scores for the AI. // Use this for initialization void Start() { gHandler = FindObjectOfType <GUIHandler> (); if (gHandler == null) { Debug.Log("ERROR: Could not find GUIHandler script!"); } scoreBoard = new int[BOARDDIMENSIONS]; InitScoreboard(); }
public void Init() { Initialized = true; Character = new RPGCharacter(player); Inventory = new InventoryHandler(this); if (!Main.dedServ && player.IsLocalPlayer()) { _guiHandler = new GUIHandler(); } }
// public GUI() public void Init() { //guihandler _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(Instances.Renderer.RC); var fontLato = AssetStorage.Get<Font>("Montserrat-Regular.ttf"); fontLato.UseKerning = true; _guiLatoBlack = new FontMap(fontLato, 18); //_guiBackground = new GUIImage(AssetStorage.Get<ImageData>("himmel.jpg"), -30, -300, -5, 1500, 1000); //_guiHandler.Add(_guiBackground); _guiPoints = new GUIText("SCORE" + " "+ Instances.Main.score, _guiLatoBlack, Instances.Main.Width - 150, 57); _guiHandler.Add(_guiPoints); }
// Konstruktor public GUIRender(RenderContext rc, BeeTheGame thisGame) { RC = rc; _game = thisGame; //GUIHandler an den Kontext anhaengen _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(rc); //Bilder einbinden _guiImageDummy = new GUIImage("Assets/dummy.png", 0, 0, 0, 5, 5); _guiImageBarText = new GUIImage("Assets/nectarCollected.png", 10, 10, -1, 153, 23); _guiImageStartBack = new GUIImage("Assets/background.png", 0, 0, 0, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height/9)*2); _guiImageGameHelp = new GUIImage("Assets/gameHelp.png", 0, 0, 0, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height/9)*2); _guiImageStartBee = new GUIImage("Assets/beePlaceholder.png", 200, 30, 1, 130, 118); _guiImageStartPlay = new GUIImage("Assets/play.png", (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width/2 - 300/2), 0, 2, 300, (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height/9)*2); _guiImageHelpButton = new GUIImage("Assets/helpButton.png", 10, 10, 2, 41, 50); _guiImageHelpOne = new GUIImage("Assets/helpOne.png", 100, 10, 1, 300, 129); _guiImageHelpTwo = new GUIImage("Assets/helpTwo.png", 950, 20, 1, 300, 130); //Text _guiFontArial24 = RC.LoadFont("Assets/arial.ttf", 16); _guiArial24 = new GUIText("Score: ", _guiFontArial24, 1200, 25); _guiArial24.TextColor = new float4(1, 1, 1, 1); //Button _guiButtonPlay = new GUIButton((System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width/2 - 300/2), 0, 3, 300, (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height/9)*2); _guiButtonPlay.ButtonColor = new float4(0, 0, 0, 0); _guiButtonPlay.BorderColor = new float4(0, 0, 0, 1); _guiButtonPlay.BorderWidth = 0; _guiButtonHelp = new GUIButton(10, 10, 1, 50, 50); //Buttonfarbe setzen _guiButtonHelp.ButtonColor = new float4(0, 0, 0, 0); _guiButtonHelp.BorderColor = new float4(0, 0, 0, 1); _guiButtonHelp.BorderWidth = 0; //an den Handler anhaengen _guiHandler.Add(_guiImageDummy); _guiHandler.Add(_guiImageBarText); _guiImagePause = new GUIImage("Assets/gamePaused.png", 350, 40, 0, 500, 100); }
public GUI(RenderContext rc, GameWorld gw) { //Basic Init _gw = gw; _fontSmall = rc.LoadFont("Assets/Cabin.ttf", 12); _fontMedium = rc.LoadFont("Assets/Cabin.ttf", 18); _fontBig = rc.LoadFont("Assets/Cabin.ttf", 40); _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(rc); //Start Pannel Init _startPanel1 = new GUIPanel("RocketGame", _fontMedium, 10, 10, 150, 110); _startPanelButtonStart = new GUIButton("Start", _fontSmall, 10, 30, 130, 30); _startPanelButtonStart.OnGUIButtonDown += OnGUIButtonDown; _startPanelButtonStart.OnGUIButtonUp += OnGUIButtonUp; _startPanelButtonStart.OnGUIButtonEnter += OnGUIButtonEnter; _startPanelButtonStart.OnGUIButtonLeave += OnGUIButtonLeave; _startPanelButtonStuff = new GUIButton("Stuff", _fontSmall, 10, 70, 130, 30); _startPanelButtonStuff.OnGUIButtonDown += OnGUIButtonDown; _startPanelButtonStuff.OnGUIButtonUp += OnGUIButtonUp; _startPanelButtonStuff.OnGUIButtonEnter += OnGUIButtonEnter; _startPanelButtonStuff.OnGUIButtonLeave += OnGUIButtonLeave; _startPanel1.ChildElements.Add(_startPanelButtonStart); _startPanel1.ChildElements.Add(_startPanelButtonStuff); _startPanel2 = new GUIPanel("Find and activate all the red cubes!", _fontMedium, 170, 20, 300, 30); _playPanel = new GUIPanel("Goals found:", _fontMedium, 10, 10, 150, 60); _playScore = new GUIText("", _fontMedium, 48, 45, new float4(1, 0, 0, 1)); _playPanel.ChildElements.Add(_playScore); _overText = new GUIText("Game Over, you Win!", _fontBig, 200, 100, new float4(0, 1, 0, 1)); ShowStartGUI(); }
/* ============================================================================ Init functions ============================================================================ */ public void Init() { this.ClearData(); this.partyHandler = new PartyHandler(); if(Application.isPlaying) { if(this.levelHandler == null) { GameObject tmp = new GameObject("LevelHandler"); if(GUISystemType.ORK.Equals(DataHolder.GameSettings().guiSystemType)) { this.levelHandler = (LevelHandler)tmp.AddComponent("LevelHandler"); } else { this.levelHandler = (LevelHandlerGUI)tmp.AddComponent("LevelHandlerGUI"); } } if(this.musicHandler == null) { GameObject tmp = new GameObject("MusicHandler"); this.musicHandler = (MusicHandler)tmp.AddComponent("MusicHandler"); } if(this.dropHandler == null) { GameObject tmp = new GameObject("DropHandler"); this.dropHandler = (DropHandler)tmp.AddComponent("DropHandler"); this.dropHandler.ClearData(); } if(this.dragHandler == null) { GameObject tmp = new GameObject("DragHandler"); this.dragHandler = (DragHandler)tmp.AddComponent("DragHandler"); } if(this.windowHandler == null) { this.windowHandler = new WindowHandler(); } if(this.guiHandler == null) { GameObject tmp = new GameObject("GUIHandler"); this.guiHandler = (GUIHandler)tmp.AddComponent("GUIHandler"); } } }
internal void MainMenuGui() { Console.WriteLine("MainMenuGui"); var height = _rCanvas.Height; var width = _rCanvas.Width; _guiHandler = _mainmenuHandler; _mainmenuHandler.Add(_guiImages[(int) _btnimages.Startbild]); _mainmenuHandler.Add(_guiImages[(int) _btnimages.btniStart]); _mainmenuHandler.Add(_guiTextTitel); _mainmenuHandler.Add(_guiText3); _mainmenuHandler.Add(_guiImages[(int)_btnimages.btniMouse]); //Mouse-Anleitung wird angezeigt _mainmenuHandler.Add(_guiDiffs[(int) _buttons.btnStart]); _guiDiffs[(int) _buttons.btnStart].OnGUIButtonDown += OnbtnPlay; }
// is called on startup public override void Init() { RC.ClearColor = new float4(0.2f, 0.2f, 0.2f, 1); _smokeTexture = RC.CreateShader(_smokeEmitter.VsSimpleTexture, _smokeEmitter.PsSimpleTexture); _fireRedTexture = RC.CreateShader(_fireRedEmitter.VsSimpleTexture, _fireRedEmitter.PsSimpleTexture); _fireYellowTexture = RC.CreateShader(_fireYellowEmitter.VsSimpleTexture, _fireYellowEmitter.PsSimpleTexture); _starTexture = RC.CreateShader(_starEmitter.VsSimpleTexture, _starEmitter.PsSimpleTexture); _smokeParam = _smokeTexture.GetShaderParam("texture1"); _fireRedParam = _fireRedTexture.GetShaderParam("texture1"); _fireYellowParam = _fireYellowTexture.GetShaderParam("texture1"); _starParam = _starTexture.GetShaderParam("texture1"); // load texture var imgSmokeData = RC.LoadImage("Assets/smoke_particle.png"); var imgFireRedData = RC.LoadImage("Assets/fireRed.png"); var imgFireYellowData = RC.LoadImage("Assets/fireYellowTexture.png"); var imgStarData = RC.LoadImage("Assets/star.png"); _iSmoke = RC.CreateTexture(imgSmokeData); _iFireRed = RC.CreateTexture(imgFireRedData); _iFireYellow = RC.CreateTexture(imgFireYellowData); _iStar = RC.CreateTexture(imgStarData); RC.SetRenderState(new RenderStateSet { ZEnable = false, AlphaBlendEnable = true, BlendOperation = BlendOperation.Add, SourceBlend = Blend.SourceAlpha, DestinationBlend = Blend.InverseSourceAlpha }); // GUIHandler _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); // font + text _guiFontCabin18 = RC.LoadFont("Assets/Cabin.ttf", 18); _guiFontCabin24 = RC.LoadFont("Assets/Cabin.ttf", 24); _guiText = new GUIText("Fusee3D Particle System ", _guiFontCabin24, 510, 35); _guiText.TextColor = new float4(1, 1, 1, 1); _guiHandler.Add(_guiText); // panel _guiPanel = new GUIPanel("Menu", _guiFontCabin18, 10, 10, 150, 150); _guiHandler.Add(_guiPanel); // Example 1 button _guiExampleOneButton = new GUIButton("Fog", _guiFontCabin18, 25, 40, 100, 25); _guiExampleOneButton.OnGUIButtonDown += OnMenuButtonDown; _guiExampleOneButton.OnGUIButtonUp += OnMenuButtonUp; _guiExampleOneButton.OnGUIButtonEnter += OnMenuButtonEnter; _guiExampleOneButton.OnGUIButtonLeave += OnMenuButtonLeave; _guiPanel.ChildElements.Add(_guiExampleOneButton); // Example 2 button _guiExampleTwoButton = new GUIButton("Fire", _guiFontCabin18, 25, 70, 100, 25); _guiExampleTwoButton.OnGUIButtonDown += OnMenuButtonDown; _guiExampleTwoButton.OnGUIButtonUp += OnMenuButtonUp; _guiExampleTwoButton.OnGUIButtonEnter += OnMenuButtonEnter; _guiExampleTwoButton.OnGUIButtonLeave += OnMenuButtonLeave; _guiPanel.ChildElements.Add(_guiExampleTwoButton); // Example 2 button _guiExampleThreeButton = new GUIButton("Stars", _guiFontCabin18, 25, 100, 100, 25); _guiExampleThreeButton.OnGUIButtonDown += OnMenuButtonDown; _guiExampleThreeButton.OnGUIButtonUp += OnMenuButtonUp; _guiExampleThreeButton.OnGUIButtonEnter += OnMenuButtonEnter; _guiExampleThreeButton.OnGUIButtonLeave += OnMenuButtonLeave; _guiPanel.ChildElements.Add(_guiExampleThreeButton); }
// Use this for initialization void Start () { txt = GetComponent<Text>(); GameObject go = GameObject.Find("GUIManager"); guih = transform.root.GetComponent<GUIHandler>(); pod = guih.pod; }
public override void Init() { // Set ToonShaderEffect _shaderEffect.AttachToContext(RC); // Setup GUI // GUIHandler _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); // font + text _guiFontCabin18 = RC.LoadFont("Assets/Cabin.ttf", 18); _guiFontCabin24 = RC.LoadFont("Assets/Cabin.ttf", 24); _guiText = new GUIText("FUSEE Shader Demo", _guiFontCabin24, 30, Height - 30) { TextColor = new float4(1, 1, 1, 1) }; _guiHandler.Add(_guiText); // image _guiImage = new GUIImage("Assets/repbg.jpg", 0, 0, -5, Width, Height); _guiHandler.Add(_guiImage); _borderImage = new GUIImage("Assets/redbg.png", 0, 0, -4, 230, 32); //_guiHandler.Add(_borderImage); //* Menu1: Select Shader _panelSelectShader = new GUIPanel("Select Shader", _guiFontCabin24, 10, 10, 230, 230); _panelSelectShader.ChildElements.Add(_borderImage); _guiHandler.Add(_panelSelectShader); //** Possible Shader Buttons _btnDiffuseColorShader = new GUIButton("Diffuse Color", _guiFontCabin18, 25, 40, 180, 25); _btnTextureShader = new GUIButton("Texture Only", _guiFontCabin18, 25, 70, 180, 25); _btnDiffuseTextureShader = new GUIButton("Diffuse Texture", _guiFontCabin18, 25, 100, 180, 25); _btnDiffuseBumpTextureShader = new GUIButton("Diffuse Bump Texture", _guiFontCabin18, 25, 130, 180, 25); _btnSpecularTexture = new GUIButton("Specular Texture", _guiFontCabin18, 25, 160, 180, 25); _btnToon = new GUIButton("Toon", _guiFontCabin18, 25, 190, 180, 25); //*** Add Handlers _btnDiffuseColorShader.OnGUIButtonDown += OnMenuButtonDown; _btnDiffuseColorShader.OnGUIButtonUp += OnMenuButtonUp; _btnDiffuseColorShader.OnGUIButtonEnter += OnMenuButtonEnter; _btnDiffuseColorShader.OnGUIButtonLeave += OnMenuButtonLeave; _btnTextureShader.OnGUIButtonDown += OnMenuButtonDown; _btnTextureShader.OnGUIButtonUp += OnMenuButtonUp; _btnTextureShader.OnGUIButtonEnter += OnMenuButtonEnter; _btnTextureShader.OnGUIButtonLeave += OnMenuButtonLeave; _btnDiffuseTextureShader.OnGUIButtonDown += OnMenuButtonDown; _btnDiffuseTextureShader.OnGUIButtonUp += OnMenuButtonUp; _btnDiffuseTextureShader.OnGUIButtonEnter += OnMenuButtonEnter; _btnDiffuseTextureShader.OnGUIButtonLeave += OnMenuButtonLeave; _btnDiffuseBumpTextureShader.OnGUIButtonDown += OnMenuButtonDown; _btnDiffuseBumpTextureShader.OnGUIButtonUp += OnMenuButtonUp; _btnDiffuseBumpTextureShader.OnGUIButtonEnter += OnMenuButtonEnter; _btnDiffuseBumpTextureShader.OnGUIButtonLeave += OnMenuButtonLeave; _btnSpecularTexture.OnGUIButtonDown += OnMenuButtonDown; _btnSpecularTexture.OnGUIButtonUp += OnMenuButtonUp; _btnSpecularTexture.OnGUIButtonEnter += OnMenuButtonEnter; _btnSpecularTexture.OnGUIButtonLeave += OnMenuButtonLeave; _btnToon.OnGUIButtonDown += OnMenuButtonDown; _btnToon.OnGUIButtonUp += OnMenuButtonUp; _btnToon.OnGUIButtonEnter += OnMenuButtonEnter; _btnToon.OnGUIButtonLeave += OnMenuButtonLeave; //**** Add Buttons to Panel _panelSelectShader.ChildElements.Add(_btnDiffuseColorShader); _panelSelectShader.ChildElements.Add(_btnTextureShader); _panelSelectShader.ChildElements.Add(_btnDiffuseTextureShader); _panelSelectShader.ChildElements.Add(_btnDiffuseBumpTextureShader); _panelSelectShader.ChildElements.Add(_btnSpecularTexture); _panelSelectShader.ChildElements.Add(_btnToon); //* Menu3: Select Mesh _panelSelectMesh = new GUIPanel("Select Mesh", _guiFontCabin24, 270, 10, 230, 130); _panelSelectMesh.ChildElements.Add(_borderImage); _guiHandler.Add(_panelSelectMesh); //** Possible Meshes _btnCube = new GUIButton("Cube", _guiFontCabin18, 25, 40, 180, 25); _btnSphere = new GUIButton("Sphere", _guiFontCabin18, 25, 70, 180, 25); _btnTeapot = new GUIButton("Teapot", _guiFontCabin18, 25, 100, 180, 25); _panelSelectMesh.ChildElements.Add(_btnCube); _panelSelectMesh.ChildElements.Add(_btnSphere); _panelSelectMesh.ChildElements.Add(_btnTeapot); //** Add handlers _btnCube.OnGUIButtonDown += OnMenuButtonDown; _btnCube.OnGUIButtonUp += OnMenuButtonUp; _btnCube.OnGUIButtonEnter += OnMenuButtonEnter; _btnCube.OnGUIButtonLeave += OnMenuButtonLeave; _btnSphere.OnGUIButtonDown += OnMenuButtonDown; _btnSphere.OnGUIButtonUp += OnMenuButtonUp; _btnSphere.OnGUIButtonEnter += OnMenuButtonEnter; _btnSphere.OnGUIButtonLeave += OnMenuButtonLeave; _btnTeapot.OnGUIButtonDown += OnMenuButtonDown; _btnTeapot.OnGUIButtonUp += OnMenuButtonUp; _btnTeapot.OnGUIButtonEnter += OnMenuButtonEnter; _btnTeapot.OnGUIButtonLeave += OnMenuButtonLeave; //* Menu2: Light Settings _panelLightSettings = new GUIPanel("Light Settings", _guiFontCabin24, 530, 10, 230, 130); _panelLightSettings.ChildElements.Add(_borderImage); _guiHandler.Add(_panelLightSettings); //** Possible Light Settings _btnDirectionalLight = new GUIButton("Directional Light", _guiFontCabin18, 25, 40, 180, 25); _btnPointLight = new GUIButton("Point Light", _guiFontCabin18, 25, 70, 180, 25); _btnSpotLight = new GUIButton("Spot Light", _guiFontCabin18, 25, 100, 180, 25); _panelLightSettings.ChildElements.Add(_btnDirectionalLight); _panelLightSettings.ChildElements.Add(_btnPointLight); _panelLightSettings.ChildElements.Add(_btnSpotLight); //*** Add Handlers _btnDirectionalLight.OnGUIButtonDown += OnMenuButtonDown; _btnDirectionalLight.OnGUIButtonUp += OnMenuButtonUp; _btnDirectionalLight.OnGUIButtonEnter += OnMenuButtonEnter; _btnDirectionalLight.OnGUIButtonLeave += OnMenuButtonLeave; _btnPointLight.OnGUIButtonDown += OnMenuButtonDown; _btnPointLight.OnGUIButtonUp += OnMenuButtonUp; _btnPointLight.OnGUIButtonEnter += OnMenuButtonEnter; _btnPointLight.OnGUIButtonLeave += OnMenuButtonLeave; _btnSpotLight.OnGUIButtonDown += OnMenuButtonDown; _btnSpotLight.OnGUIButtonUp += OnMenuButtonUp; _btnSpotLight.OnGUIButtonEnter += OnMenuButtonEnter; _btnSpotLight.OnGUIButtonLeave += OnMenuButtonLeave; // Setup 3D Scene // Load Images and Assign iTextures var imgTexture = RC.LoadImage("Assets/crateTexture.jpg"); var imgBumpTexture = RC.LoadImage("Assets/crateNormal.jpg"); _texCube = RC.CreateTexture(imgTexture); _texBumpCube = RC.CreateTexture(imgBumpTexture); imgTexture = RC.LoadImage("Assets/earthTexture.jpg"); imgBumpTexture = RC.LoadImage("Assets/earthNormal.jpg"); _texSphere = RC.CreateTexture(imgTexture); _texBumpSphere = RC.CreateTexture(imgBumpTexture); imgTexture = RC.LoadImage("Assets/porcelainTexture.png"); imgBumpTexture = RC.LoadImage("Assets/normalRust.jpg"); _texTeapot = RC.CreateTexture(imgTexture); _texBumpTeapot = RC.CreateTexture(imgBumpTexture); _currentTexture = _texCube; _currentBumpTexture = _texBumpCube; // Load Meshes _meshCube = MeshReader.LoadMesh(@"Assets/Cube.obj.model"); _meshSphere = MeshReader.LoadMesh(@"Assets/Sphere.obj.model"); _meshTeapot = MeshReader.LoadMesh(@"Assets/Teapot.obj.model"); // Set current Mesh and Update GUI _currentMesh = _meshCube; _btnCube.ButtonColor = ColorHighlightedButton; // Setup Shaderprograms and Update GUI _shaderDiffuseColor = MoreShaders.GetDiffuseColorShader(RC); _shaderDiffuseTexture = MoreShaders.GetDiffuseTextureShader(RC); _shaderTexture = MoreShaders.GetSkyboxShader(RC); _shaderDiffuseBumpTexture = MoreShaders.GetBumpDiffuseShader(RC); _shaderSpecularTexture = MoreShaders.GetSpecularShader(RC); _btnDiffuseColorShader.ButtonColor = ColorHighlightedButton; _currentShader = _shaderDiffuseColor; RC.SetShader(_shaderDiffuseColor); // Setup ShaderParams _paramColor = _shaderDiffuseColor.GetShaderParam("color"); // Setup Light and Update GUI RC.SetLightActive(0, 1); RC.SetLightPosition(0, new float3(5.0f, 0.0f, -2.0f)); RC.SetLightAmbient(0, new float4(0.2f, 0.2f, 0.2f, 1.0f)); RC.SetLightSpecular(0, new float4(0.1f, 0.1f, 0.1f, 1.0f)); RC.SetLightDiffuse(0, new float4(0.8f, 0.8f, 0.8f, 1.0f)); RC.SetLightDirection(0, new float3(-1.0f, 0.0f, 0.0f)); RC.SetLightSpotAngle(0, 10); _btnDirectionalLight.ButtonColor = ColorHighlightedButton; }
void OnApplicationQuit() { inst = null; }
// Use this for initialization void Start () { txt = GetComponent<Text>(); guih = transform.root.GetComponent<GUIHandler>(); pod = guih.pod; }
internal void HighScoreGui() { var height = _rCanvas.Height; var width = _rCanvas.Width; _highscore = true; _guiHandler = _highScoreHandler; // Erst if-Abfrage, ob ich grad aus der Pause komme, weil ich dann nichts überschreiben will if (_gameHandler.GameState.LastState != GameState.State.HiddenPause && _gameHandler.GameState.CurrentState == GameState.State.Highscore) { Console.WriteLine("HighScoreGui"); _guiHandler.Clear(); // Alte Infos aus dem GameHandler entfernen (z.B. Stand der Tomaten) for (int i = 0; i < 10; i++) //Restliche Tomaten aus dem Spiel noch entfernen { _highScoreHandler.Remove(_guiImageTomato[i]); } // Bilder&Texte&Buttons hinzufügen _highScoreHandler.Add(_guiImages[(int) _btnimages.Endbild]); _highScoreHandler.Add(_guiImages[(int) _btnimages.btniCreditsA]); _highScoreHandler.Add(_guiImages[(int) _btnimages.btniNochmal]); _highScoreHandler.Add(_guiImages[(int) _btnimages.btniHighscore]); _highScoreHandler.Add(_guiText5); _highScoreHandler.Add(_guiText6); _highScoreHandler.Add(nameInput); _highScoreHandler.Add(_name); _highScoreHandler.Add(_guiCredits); _highScoreHandler.Add(_guiDiffs[(int) _buttons.btnCredits]); _highScoreHandler.Add(_guiDiffs[(int) _buttons.btnNochmal]); _highScoreHandler.Add(_guiDiffs[(int) _buttons.btnHighscore]); _guiDiffs[(int)_buttons.btnNochmal].OnGUIButtonDown += OnbtnPlay; _guiDiffs[(int)_buttons.btnHighscore].OnGUIButtonDown += OnbtnHighscore; _guiDiffs[(int)_buttons.btnCredits].OnGUIButtonDown += Credits; // Punkte if (_highScoreHandler.Contains(_guiText4)) { _highScoreHandler.Remove(_guiText4); } float textwidth; textwidth = GUIText.GetTextWidth("You reached --- Points!", _guiFontWESTERN30); _guiText4 = new GUIText("You reached " + _points + " Points!", _guiFontWESTERN30, width / 2 - (int)(textwidth / 2), (height / 3), new float4(1, 0, 0, 1)); _highScoreHandler.Add(_guiText4); } }
//da initialisieren wir alles für den GuiHandler public Gui(RenderContext RC, RenderCanvas rCanvas, GameHandler gameHandler) { #region Variablen _rCanvas = rCanvas; var height = _rCanvas.Height; var width = _rCanvas.Width; _gameHandler = gameHandler; _guiHandler = new GUIHandler(RC); _mainmenuHandler = new GUIHandler(RC); _inGameHandler = new GUIHandler(RC); _highScoreHandler = new GUIHandler(RC); _guiDiffs = new GUIButton[4]; _guiImageTomato = new GUIImage[10]; _guiImages = new GUIImage[9]; _highscoreBretter = new GUIImage[5]; float textwidth; float texthight; _highscore = false; _neustart = true; _pause = true; _level = 1; #endregion #region Bilder //Hintergrund Startscreen _guiImages[(int)_btnimages.Startbild] = new GUIImage("Assets/startbild.png", 0, 0,-3, width, height); //Hintergrund Endscreen _guiImages[(int)_btnimages.Endbild] = new GUIImage("Assets/endbild.png", 0, 0, -3, width, height); //Maus-Nutzerinfo in Mainmenü einblenden _guiImages[(int)_btnimages.btniMouse] = new GUIImage("Assets/Mouse.png", width / 4, 0, -1, (int)(height / 1.322), height); //Fadenkreuz flexibel (Falls es zwecks Schwierigkeitsstufe kleiner werden soll) _aimimage = 80; _guiImages[(int)_btnimages.btniFadenkreuz] = new GUIImage("Assets/Fadenkreuz.png", width / 2 - _aimimage / 2, height / 2 - _aimimage / 2, -2, _aimimage, _aimimage); // Credits Klohaus _guiImages[(int)_btnimages.btniCreditsA] = new GUIImage("Assets/kloClosed.png", width - height, 0, -1, height, height); _guiImages[(int)_btnimages.btniCreditsB] = new GUIImage("Assets/kloOpen.png", width - height, 0, -1, height, height); #endregion #region Beschriftungen //Schriften _guiFontCabin12 = RC.LoadFont("Assets/Cabin.ttf", 12); _guiFontCabin14 = RC.LoadFont("Assets/Cabin.ttf", 14); _guiFontCabin18 = RC.LoadFont("Assets/Cabin.ttf", 18); _guiFontCabin100 = RC.LoadFont("Assets/Cabin.ttf", 100); _guiFontWESTERN30 = RC.LoadFont("Assets/WESTERN.ttf", 30); //Credits texthight = GUIText.GetTextHeight("So hoch.", _guiFontCabin18); textwidth = GUIText.GetTextWidth("Sooooooooo laaaaaang", _guiFontCabin14); _guiTextCredits1 = new GUIText("Ramazan Gündogdu", _guiFontCabin14, (width) - (int)(textwidth), (height / 3)+ (int)(texthight/2), new float4(1, 1, 1, 1)); _guiTextCredits2 = new GUIText("Kathleen Hübel", _guiFontCabin14, (width) - (int)(textwidth), (int)(_guiTextCredits1.PosY + texthight), new float4(1, 1, 1, 1)); _guiTextCredits3 = new GUIText("Linda Schey", _guiFontCabin14, (width) - (int)(textwidth), (int)(_guiTextCredits2.PosY + texthight), new float4(1, 1, 1, 1)); _guiTextCredits4 = new GUIText("Susanne Schmidt", _guiFontCabin14, (width) - (int)(textwidth), (int)(_guiTextCredits3.PosY + texthight), new float4(1, 1, 1, 1)); _guiTextCredits5 = new GUIText("Tobias Winterhalder ", _guiFontCabin14, (width) - (int)(textwidth), (int)(_guiTextCredits4.PosY + texthight), new float4(1, 1, 1, 1)); //Eingabetext Name für Highscore texthight = GUIText.GetTextHeight("Lorem ipsum", _guiFontCabin18); textwidth = GUIText.GetTextWidth("Write name: ", _guiFontCabin18); _name = new GUIText("Write name: ", _guiFontCabin18, (width / 2) - (int)(textwidth), (height / 2), new float4(0, 0, 0, 1)); nameInput = new GUIText("", _guiFontCabin18, (width / 2), (height / 2), new float4(1, 1, 1, 1)); //Text Mainmenü: Scha(r)fschießen textwidth = GUIText.GetTextWidth("Scha(r)fschießen", _guiFontWESTERN30); _guiTextTitel = new GUIText("Scha(r)fschießen", _guiFontWESTERN30, (width/2) - (int) (textwidth/2), (height/3)); _guiTextTitel.TextColor = new float4(0, 0, 0, 1); // Text InGame textwidth = GUIText.GetTextWidth("Time: ", _guiFontCabin18); texthight = GUIText.GetTextHeight("Time: ", _guiFontCabin18); _guiText1 = new GUIText("Time: " + _countdown, _guiFontCabin18, (int)textwidth, (int)(texthight*2)); _guiText1.TextColor = new float4(0, 0, 0, 1); textwidth = GUIText.GetTextWidth("Time: ", _guiFontCabin18); _guiText2 = new GUIText("Points: " + _points, _guiFontCabin18, width - (int)(textwidth * 3), (int)(texthight*2)); _guiText2.TextColor = new float4(0, 0, 0, 1); //Text LevelUp textwidth = GUIText.GetTextWidth("Level Up!", _guiFontCabin100); _guiText7 = new GUIText("Level Up!", _guiFontCabin100, (width / 2) - (int)(textwidth/2), (height / 2)); _guiText7.TextColor = new float4(1, 0, 0, 0.5f); #endregion #region Buttons // Button MainMenü: Starten textwidth = GUIText.GetTextWidth("Start", _guiFontWESTERN30); texthight = GUIText.GetTextHeight("Start", _guiFontWESTERN30); _guiText3 = new GUIText("Start", _guiFontWESTERN30, width / 2 - (int)(textwidth / 2), (int)(height / 1.5)); _guiText3.TextColor = new float4(1, 1, 1, 1); _guiDiffs[(int)_buttons.btnStart] = new GUIButton(_guiText3.PosX - (int)(texthight / 2), _guiText3.PosY - (int)texthight, -2, (int)(textwidth * 1.5), (int)(texthight * 1.5)); _guiImages[(int)_btnimages.btniStart] = new GUIImage("Assets/holz.png", _guiText3.PosX - (int)textwidth / 2, _guiText3.PosY - (int)(texthight * 1.5), -1, (int)textwidth * 2, (int)texthight * 2); // Button HighscoreMenü: Nochmal spielen textwidth = GUIText.GetTextWidth("Play again", _guiFontCabin18); _guiText5 = new GUIText("Play again", _guiFontCabin18, (width / 2) - (int)(textwidth * 1.5), (height / 2 + height / 3)); _guiText5.TextColor = new float4(1, 1, 1, 1); texthight = GUIText.GetTextHeight("Play again", _guiFontCabin18); _guiDiffs[(int) _buttons.btnNochmal] = new GUIButton(_guiText5.PosX, _guiText5.PosY - (int) texthight, -2, (int) textwidth, (int) texthight); _guiImages[(int) _btnimages.btniNochmal] = new GUIImage("Assets/holz.png", _guiText5.PosX - (int) textwidth/2, _guiText5.PosY - (int) (texthight*1.5), -1, (int) textwidth*2, (int) texthight*2); // Button HighscoreMenü: Highscore textwidth = GUIText.GetTextWidth("Enter in Highscore", _guiFontCabin18); _guiText6 = new GUIText("Enter in Highscore", _guiFontCabin18, (width / 2) + (int)(textwidth / 5), (height / 2 + height / 3)); _guiText6.TextColor = new float4(1, 1, 1, 1); texthight = GUIText.GetTextHeight("Enter in Highscore", _guiFontCabin18); _guiDiffs[(int) _buttons.btnHighscore] = new GUIButton(_guiText6.PosX, _guiText6.PosY - (int) texthight, -2, (int) textwidth, (int) texthight); _guiImages[(int) _btnimages.btniHighscore] = new GUIImage("Assets/holz.png",_guiText6.PosX - (int)textwidth / 8, _guiText6.PosY - (int)(texthight * 1.5), -1, (int)(textwidth * 1.2), (int) texthight*2); //Button Credits textwidth = GUIText.GetTextWidth("Credits", _guiFontCabin18); texthight = GUIText.GetTextWidth("Credits", _guiFontCabin18); _guiCredits = new GUIText("Credits", _guiFontCabin18, width - (int)(textwidth*1.5), (height / 2), new float4(1, 1, 1, 1)); _guiDiffs[(int)_buttons.btnCredits] = new GUIButton(_guiCredits.PosX, _guiCredits.PosY - (int)texthight, -2, (int)textwidth, (int)texthight); #endregion }
internal void InGameGui() { //set guiHander für während das Spiel läuft (während der Pause?) Console.WriteLine("InGameGui"); _countdown = _gameHandler.Game.Countdown; // Erst if-Abfrage, ob ich grad aus der Pause komme, weil ich dann nichts überschreiben will if (_gameHandler.GameState.LastState == GameState.State.HiddenPause && _gameHandler.GameState.CurrentState == GameState.State.Playing) { _neustart = false; // Komme also aus der Pause und will nichts verändern } else // Starte neues Spiel { _neustart = true; for (int i = 0; i < 10; i++) //alle Tomaten noch weg { _guiHandler.Remove(_guiImageTomato[i]); } } #region Neustart if (_neustart) { _guiHandler.Clear(); _guiHandler = _inGameHandler; _inGameHandler.Remove(_guiTextTitel); _inGameHandler.Add(_guiText1); _inGameHandler.Add(_guiText2); _inGameHandler.Add(_guiImages[(int)_btnimages.btniFadenkreuz]); _munition = _gameHandler.Game.Weapon.Magazin; for (int i = 0; i < 10; i++) { _guiHandler.Remove(_guiImageTomato[i]); } DrawMunition(); } #endregion _pause = true; }
public override void Init() { // is called on startup Width = 616; Height = 688; // GUIHandler _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); // font + text _guiFontCabin18 = RC.LoadFont("Assets/Cabin.ttf", 18); _guiFontCabin24 = RC.LoadFont("Assets/Cabin.ttf", 24); _guiText = new GUIText("Spot all seven differences!", _guiFontCabin24, 310, 35); _guiText.TextColor = new float4(1, 1, 1, 1); _guiHandler.Add(_guiText); // image _guiImage = new GUIImage("Assets/spot_the_diff.png", 0, 0, -5, 600, 650); _guiHandler.Add(_guiImage); // buttons / rectangles _guiUDiffs = new GUIButton[7]; _guiBDiffs = new GUIButton[7]; _guiUDiffs[0] = new GUIButton(240, 3, 40, 40); _guiBDiffs[0] = new GUIButton(240, 328, 40, 40); _guiUDiffs[1] = new GUIButton(3, 270, 40, 40); _guiBDiffs[1] = new GUIButton(3, 595, 40, 40); _guiUDiffs[2] = new GUIButton(220, 255, 40, 40); _guiBDiffs[2] = new GUIButton(220, 580, 40, 40); _guiUDiffs[3] = new GUIButton(325, 170, 40, 40); _guiBDiffs[3] = new GUIButton(325, 495, 40, 40); _guiUDiffs[4] = new GUIButton(265, 110, 40, 40); _guiBDiffs[4] = new GUIButton(265, 435, 40, 40); _guiUDiffs[5] = new GUIButton(490, 215, 40, 40); _guiBDiffs[5] = new GUIButton(490, 540, 40, 40); _guiUDiffs[6] = new GUIButton(495, 280, 40, 40); _guiBDiffs[6] = new GUIButton(495, 605, 40, 40); for (int i = 0; i < 7; i++) { _guiUDiffs[i].ButtonColor = new float4(0, 0, 0, 0); _guiBDiffs[i].ButtonColor = new float4(0, 0, 0, 0); _guiUDiffs[i].BorderColor = new float4(0, 0, 0, 1); _guiBDiffs[i].BorderColor = new float4(0, 0, 0, 1); _guiUDiffs[i].BorderWidth = 0; _guiBDiffs[i].BorderWidth = 0; _guiUDiffs[i].Tag = _guiBDiffs[i]; _guiBDiffs[i].Tag = _guiUDiffs[i]; _guiBDiffs[i].OnGUIButtonDown += OnDiffButtonDown; _guiUDiffs[i].OnGUIButtonDown += OnDiffButtonDown; _guiHandler.Add(_guiUDiffs[i]); _guiHandler.Add(_guiBDiffs[i]); } // panel _guiPanel = new GUIPanel("Menu", _guiFontCabin18, 10, 10, 150, 110); _guiHandler.Add(_guiPanel); // reset button _guiResetButton = new GUIButton("Reset", _guiFontCabin18, 25, 40, 100, 25); _guiResetButton.OnGUIButtonDown += OnMenuButtonDown; _guiResetButton.OnGUIButtonUp += OnMenuButtonUp; _guiResetButton.OnGUIButtonEnter += OnMenuButtonEnter; _guiResetButton.OnGUIButtonLeave += OnMenuButtonLeave; _guiPanel.ChildElements.Add(_guiResetButton); // solve button _guiSolveButton = new GUIButton("Solve", _guiFontCabin18, 25, 70, 100, 25); _guiSolveButton.OnGUIButtonDown += OnMenuButtonDown; _guiSolveButton.OnGUIButtonUp += OnMenuButtonUp; _guiSolveButton.OnGUIButtonEnter += OnMenuButtonEnter; _guiSolveButton.OnGUIButtonLeave += OnMenuButtonLeave; _guiPanel.ChildElements.Add(_guiSolveButton); }