Example #1
0
        private static void SetupUI()
        {
            display        = new Display();
            display.Ready += Display_Ready;

            // Simple Dispatcher and SynchronizationContext do the same job as in a typical GUI:
            // - SynchronizationContext Keeps async code continuations running on the main (UI) thread
            // - Dispatcher allows other threads to invoke Actions on the main (UI) thread
            SynchronizationContext.SetSynchronizationContext(new ConsoleSynchronizationContext(display));
            Dispatcher.Init(display);

            mainDisplayToggler = new AreaToggler();

            scriptDisplay = new ScriptDisplay(display, debugger, new Bounds(0, 0, Length.Percent(60), -2));
            infoDisplay   = new InfoDisplay(display, new Bounds(Length.Percent(60), 0, Length.Percent(40), -2));
            helpDisplay   = new HelpDisplay(display, new Bounds(0, 0, Length.Percent(100), -2));
            prompt        = new Prompt(display, new Bounds(0, -2, Length.Percent(100), 1));
            errorDisplay  = new ErrorDisplay(display, new Bounds(0, -1, Length.Percent(100), 1));

            mainDisplayToggler
            .Add(scriptDisplay)
            .Add(helpDisplay);

            display.Add(scriptDisplay);
            display.Add(helpDisplay);
            display.Add(infoDisplay);
            display.Add(prompt);
            display.Add(errorDisplay);
        }
    void DoMyWindow(int windowID)
    {
        GUIStyle h1 = new GUIStyle(skin.label);

        h1.fontSize = 20;
        h1.margin   = new RectOffset(0, 0, 50, 0);

        GUILayout.Label(help.title, h1);
        GUILayout.Label(help.body);
        if (GUI.Button(new Rect(windowRect.width - 43, 3, 41, 41), "X"))
        {
            HelpDisplay.Close();
        }
    }
    void OnGUI()
    {
        GUI.skin = skin;


        area.width  = (new CSS()).width("96%").width();
        area.height = (new CSS()).height("96%").height();
        area.x      = (new CSS()).width("2%").width();
        area.y      = (new CSS()).height("2%").height();

        GUIStyle h1 = new GUIStyle(skin.label);

        h1.fontSize = 20;

        GUILayout.BeginArea(area);
        GUILayout.BeginVertical();
        if (GUILayout.Button("Nazaj", GUILayout.Height(50), GUILayout.Width(100)))
        {
            Application.LoadLevel("EndDay");
        }
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(area.width), GUILayout.Height(area.height - 50));

        for (int i = 0; i < NewsManager.news.Count; i++)
        {
            GUILayout.BeginHorizontal("box", GUILayout.MaxHeight(200));
            GUILayout.Label(Resources.Load <Texture>("Images/Reports/" + NewsManager.news[i].type.ToString()), GUILayout.Width(100), GUILayout.Height(100));
            GUILayout.BeginVertical();
            GUILayout.Label(NewsManager.news[i].title, h1);
            GUILayout.Label(NewsManager.news[i].message);
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Skrij", GUILayout.Height(50)))
            {
                EffectManager.affect(NewsManager.news[i].effect);
                NewsManager.news.RemoveAt(i);
            }
            if (GUILayout.Button("Pomoč", GUILayout.Height(50)))
            {
                HelpDisplay.Open(HelpManager.HelpType.lowerDemand);
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }

        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        GUILayout.EndArea();
    }
Example #4
0
    public void showHelp(HelpDisplay help)
    {
        switch (help)
        {
        case HelpDisplay.SETUP:
            tooltipText.text = "Fill each lane with a card from your hand";
            break;

        case HelpDisplay.SELECT_LANE:
            tooltipText.text = "Select a lane by click / tap and hold until the cards are revealed";
            break;

        case HelpDisplay.FILL_LANE:
            tooltipText.text = "Fill a lane with a card from your hand";
            break;

        default:
            break;
        }
        tooltipHelp.SetActive(true);
    }
Example #5
0
    void OnGUI()
    {
        GUI.skin = skin;


        area.width  = (new CSS()).width("96%").width();
        area.height = (new CSS()).height("96%").height();
        area.x      = (new CSS()).width("2%").width();
        area.y      = (new CSS()).height("2%").height();

        GUIStyle h1 = new GUIStyle(skin.label);

        h1.fontSize = 20;

        GUILayout.BeginArea(area);
        GUILayout.BeginVertical();
        if (GUILayout.Button("Novice", GUILayout.Height(50), GUILayout.Width(100)))
        {
            Application.LoadLevel("News");
        }
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(area.width), GUILayout.Height(area.height - 50));

        GUILayout.BeginHorizontal("box", GUILayout.MaxHeight(200));

        GUILayout.BeginVertical();
        GUILayout.Label("Ponudba: ", h1, GUILayout.Height(40));
        GUILayout.Label("Povpraševanje: ", h1, GUILayout.Height(40));
        GUILayout.Label("Predviden dobiček: ", h1, GUILayout.Height(40));
        GUILayout.Label("Premoženje: ", h1, GUILayout.Height(40));
        GUILayout.EndVertical();

        GUILayout.BeginVertical();
        GUILayout.Label(String.Format("{0} kepic", GameState.state.supply), GUILayout.Height(40));
        GUILayout.Label(String.Format("{0} kepic", GameState.state.demand), GUILayout.Height(40));
        GUILayout.Label(String.Format("{0} * -0.8€ + {1} * {2}€ = {3}", GameState.state.supply, GameState.state.demand, GameState.state.cena, GameManager.profit() / 100), GUILayout.Height(40));
        GUILayout.Label(String.Format("{0}€", GameState.state.premozenje), GUILayout.Height(40));
        GUILayout.EndVertical();

        GUILayout.BeginVertical();
        if (GUILayout.Button("Trgovina", GUILayout.Height(40)))
        {
            Application.LoadLevel("Shop");
        }
        GUILayout.EndVertical();

        GUILayout.BeginVertical();
        if (GUILayout.Button("Pomoč", GUILayout.Height(40)))
        {
            HelpDisplay.Open(HelpManager.HelpType.lowerDemand);
        }
        if (GUILayout.Button("Pomoč", GUILayout.Height(40)))
        {
            HelpDisplay.Open(HelpManager.HelpType.lowerDemand);
        }
        GUILayout.EndVertical();

        GUILayout.EndHorizontal();

        if (GameState.state.daysLeft <= 0)
        {
            GUILayout.Button("Konec igre", GUILayout.Height(50));
        }
        else
        {
            if (GUILayout.Button("Naslednji dan", GUILayout.Height(50)))
            {
                GameManager.applyNewDay();
            }
        }
        GUILayout.Label("Preostalo dni:" + GameState.state.daysLeft);
        GUILayout.EndScrollView();
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
Example #6
0
 private void AppendLine(string line)
 {
     HelpDisplay.AppendText(line);
     HelpDisplay.AppendText(Environment.NewLine);
     HelpDisplay.AppendText(Environment.NewLine);
 }