예제 #1
0
        void Start()
        {
            _controller = HelloApp.App.Get<GameController>();
              var model = _controller.SceneInfo().Model.As<SceneInfoViewModel>();
              _cam = model.Camera;

              var text = new nText(new Vector2(1.0f, 1.0f));
              text.Font = (Font) Resources.Load("Fonts/vinchard");
              text.FontSize = 0.5f;
              text.Text = "Select the type of tree you want to grow...";
              text.Color = new Color(0.3f, 0.3f, 0.3f);
              var p = new nProp(text);
              p.Visible = true;
              p.Position = new Vector2(-5.2f, 2.5f);

              p = new nProp("tree.1", new Vector2(2.0f, 2.0f));
              p.Visible = true;
              p.Position = new Vector2(-4.35f, -0.3f);
              p.Listen(_cam, nInputEvent.ENTER, delegate { SetNotice("Lovie", bTreeType.TREE_1, new Vector2(-4.72f, -1.5f)); });
              p.Listen(_cam, nInputEvent.EXIT, delegate { SetNotice(""); });
              p.Listen(_cam, nInputEvent.DOWN, delegate {
            HelloApp.App.Get<TreeController>().Index().Activate();
              });

              p = new nProp("tree.2", new Vector2(2.0f, 2.0f));
              p.Visible = true;
              p.Position = new Vector2(-0.35f, -0.3f);
              p.Listen(_cam, nInputEvent.ENTER, delegate { SetNotice("Nujiper", bTreeType.TREE_2, new Vector2(-0.80f, -1.5f)); });
              p.Listen(_cam, nInputEvent.EXIT, delegate { SetNotice(""); });
              p.Listen(_cam, nInputEvent.DOWN, delegate {
            HelloApp.App.Get<TreeController>().Index().Activate();
              });

              p = new nProp("tree.3", new Vector2(2.0f, 2.0f));
              p.Visible = true;
              p.Position = new Vector2(3.35f, -0.3f);
              p.Listen(_cam, nInputEvent.ENTER, delegate { SetNotice("Pamle", bTreeType.TREE_3, new Vector2(2.97f, -1.5f)); });
              p.Listen(_cam, nInputEvent.EXIT, delegate { SetNotice(""); });
              p.Listen(_cam, nInputEvent.DOWN, delegate {
            HelloApp.App.Get<TreeController>().Index().Activate();
              });

              text = new nText(new Vector2(1.0f, 1.0f));
              text.Font = (Font) Resources.Load("Fonts/vinchard");
              text.FontSize = 0.4f;
              text.Text = "";
              text.Color = new Color(0.2f, 0.5f, 0.2f);
              _notice = new nProp(text);
              _notice.Visible = true;
              _notice.Position = new Vector2(-2.0f, -3.5f);
              SetNotice("Nujiper", bTreeType.TREE_2, new Vector2(-0.8f, -1.5f));
        }
예제 #2
0
        void Start()
        {
            _controller = HelloApp.App.Get<GameController>();
              var model = _controller.SceneInfo().Model.As<SceneInfoViewModel>();
              _cam = model.Camera;

              var p = new nProp("Title", new Vector2(8.0f, 4.0f));
              p.Visible = true;
              p.Position = new Vector2(0f, 1.7f);

              var b = new nButton() {
            Camera = _cam,
            Color = Color.black,
            Texture = "new",
            OverTexture = "new.active",
            DownTexture = "new.click",
            Position = new Vector2(-.5f, -1.5f),
            Size = new Vector2(2.59f, 1.00f),
            Text = "",
            Action = delegate {
              _controller.SelectTree().Activate();
            }
              };
              b.Manifest();

              var text = new nText(new Vector2(1.0f, 1.0f));
              text.Font = (Font) Resources.Load ("Fonts/vinchard");
              text.Text = "by One Thousand Faces";
              text.FontSize = 0.3f;
              text.Color = new Color(0.4f, 0.4f, 0.4f);
              p = new nProp(text);
              p.Visible = true;
              p.Position = new Vector2(3f, -3f);

              text = new nText(new Vector2(1.0f, 1.0f));
              text.Font = (Font) Resources.Load ("Fonts/vinchard");
              text.Text = "Sandra Lim & Douglas Linder";
              text.FontSize = 0.2f;
              text.Color = new Color(0.7f, 0.7f, 0.7f);
              p = new nProp(text);
              p.Visible = true;
              p.Position = new Vector2(3f, -3.4f);
        }
예제 #3
0
    void Start()
    {
        var controller = HelloApp.App.Get<HomeController>();
        var model = controller.SceneInfo().Model.As<SceneInfoViewModel>();
        model.BackButton.Manifest();
        _cam = model.Camera;

        var light_font = (Font) Resources.Load ("Fonts/Roboto-Regular");
        var bold_font = (Font) Resources.Load ("Fonts/Roboto-BoldCondensed");

        var instance = new nText(new Vector2(1.0f, 1.0f));
        instance.Font = bold_font;
        instance.FontSize = 0.2f;
        instance.Color = Color.white;
        instance.Text = "Hello nText, yeah!\nhithere\ndfsdfasfdasfasdf\ndasfasdfasdf";

        var prop = new nProp(instance);
        prop.Visible = true;
        prop.Scale = new Vector2(1.0f, 1.0f);
        prop.Position = new Vector2(-6.0f, 2.0f);
        prop.Depth = 0;
        prop.Listen(_cam, delegate {
          nLog.Debug ("Text click");
        });

        instance = new nText(new Vector2(1.0f, 1.0f));
        instance.Font = light_font;
        instance.FontSize = 1.0f;
        instance.Color = Color.blue;
        instance.Text = "this is a blue test";

        prop = new nProp(instance);
        prop.Visible = true;
        prop.Scale = new Vector2(1.0f, 1.0f);
        prop.Position = new Vector2(-6.0f, 1.0f);
        prop.Depth = 0;
        prop.Listen(_cam, delegate {
          nLog.Debug ("Text click");
        });

        instance = new nText(new Vector2(1.0f, 1.0f));
        instance.Font = bold_font;
        instance.FontSize = 2.0f;
        instance.Color = Color.magenta;
        instance.Text = "This is a pink test which is all scaled";

        prop = new nProp(instance);
        prop.Visible = true;
        prop.Scale = new Vector2(0.5f, 1.0f);
        prop.Position = new Vector2(-6.0f, -1.0f);
        prop.Depth = 1;
        prop.Listen(_cam, delegate {
          nLog.Debug ("Text click");
        });

        instance = new nText(new Vector2(1.0f, 1.0f));
        instance.Font = bold_font;
        instance.FontSize = 0.5f;
        instance.Color = Color.green;
        instance.Text = "This is another random test we've rotated!";

        prop = new nProp(instance);
        prop.Visible = true;
        prop.Scale = new Vector2(0.8f, 1.0f);
        prop.Position = new Vector2(3.0f, 3.0f);
        prop.Rotation = -90.0f;
        prop.Depth = 0;
        prop.Listen(_cam, delegate {
          nLog.Debug ("Text click");
        });
    }
예제 #4
0
    private void SetupButtons(SceneInfoViewModel model)
    {
        _editEnabled = new nProp("edit", new Vector2(0.5f, 0.5f));
        _editDisabled = new nProp("edit.disabled", new Vector2(0.5f, 0.5f));
        _editEnabled.Listen(_cam, nInputEvent.UP, delegate {
          SetEditState(false);
        });
        _editDisabled.Listen(_cam, nInputEvent.UP, delegate {
          SetEditState(true);
        });
        SetEditState(false);

        var p = new nProp("btn-play", new Vector2(0.5f, 0.5f));
        p.Visible = true;
        p.Position = new Vector2(-4.45f, 3.0f);
        p.Listen(_cam, nInputEvent.UP, delegate {
          nLog.Debug("Play!!");
          SetEditState(false);
          _controller.UpdateGameSpeed(0.4f);
        });

        p = new nProp("btn-faster", new Vector2(0.5f, 0.5f));
        p.Visible = true;
        p.Position = new Vector2(-3.90f, 3.0f);
        p.Listen(_cam, nInputEvent.UP, delegate {
          SetEditState(false);
          _controller.UpdateGameSpeed(0.9f);
        });

        _controller.UpdateGameSpeed(0.4f);
        _controller.UpdateTime(5.0f, false);

        /*model.Button("Pause", delegate {
          Trace("Paused!");
          _controller.SetPaused(true);
        }, new Vector2(5.0f, 3.0f)).Manifest();

        model.Button("Start", delegate {
          var response = _controller.SetPaused(false);
          if (response.Success)
        Trace("Started~ (you should see an animation now depending on game speed... :P)");
          else
        Trace("You need to create a new tree by clicking 'reset' first");
        }, new Vector2(5.0f, 2.5f)).Manifest();

        model.Button("Reset", delegate {
          _controller.Reset();
          if (_lastTree != null)
        _lastTree.Visible = false;
          _lastTree = null;
        }, new Vector2(5.0f, 2.0f)).Manifest();

        model.Button("Slower", delegate {
          _controller.UpdateGameSpeed(-0.05);
        }, new Vector2(5.0f, 1.5f)).Manifest();

        model.Button("Faster", delegate {
          _controller.UpdateGameSpeed(0.05);
        }, new Vector2(5.0f, 1.0f)).Manifest();

        model.Button("Dump Config", delegate {
          _controller.DumpConfig();
        }, new Vector2(5.0f, 0.5f)).Manifest();*/

        var light_font = (Font) Resources.Load ("Fonts/vinchard");
        _trace = new nText(new Vector2(3.0f, 1.0f));
        _trace.Color = Color.black;
        _trace.FontSize = 0.2f;
        _trace.Font = light_font;
        _trace.Text = "";
        _traceProp = new nProp(_trace);
        _traceProp.Visible = true;
        _traceProp.Position = new Vector2(-7.0f, 4.5f);

        var d = new nText(new Vector2(3.0f, 2.0f));
        d.Color = Color.black;
        d.FontSize = 0.4f;
        d.Font = light_font;
        d.Text = "90 days left";
        _date = new nProp(d);
        _date.Visible = true; /* redraw text */
        _date.Position = new Vector2(3.5f, 3.2f);

        d = new nText(new Vector2(3.0f, 2.0f));
        d.Color = new Color (0.6f, 0.6f, 0.6f);
        d.FontSize = 0.25f;
        d.Font = light_font;
        d.Text = "";
        _speed = new nProp(d);
        _speed.Visible = true; /* redraw text */
        _speed.Position = new Vector2(3.6f, 2.75f);
    }
예제 #5
0
 private void DrawHelpText(String msg, float size, float x, float y)
 {
     var light_font = (Font) Resources.Load ("Fonts/vinchard");
     var t = new nText(new Vector2(1, 1));
     t.Color = new Color(0.3f, 0.4f, 0.6f);
     t.FontSize = size;
     t.Font = light_font;
     t.Text = msg;
     var tp = new nProp(t);
     tp.Visible = true;
     tp.Position = new Vector2(x, y);
     _helps.Add(tp);
 }
예제 #6
0
        public void Manifest()
        {
            if (!_visible) {
            _visible = true;

            _button = new nProp (Texture, Size);
            _button.Visible = true;
            _button.Position = Position;
            _button.Depth = 1;

            var text = new nText (Size);
            text.Text = Text;
            text.Font = (Font) Resources.Load(Font);
            text.FontSize = FontSize;
            text.Color = Color;
            _text = new nProp (text);
            _text.Visible = true;
            _text.Position = new Vector2(Position[0] - Size[0] / 3, Position[1] + Size[1] / 3);
            _text.Depth = 0;

            _button.Listen (Camera, Action);
              }
        }
예제 #7
0
        public void Manifest()
        {
            if (!_visible) {
            _visible = true;

            _button = new nProp (Texture, Size);
            _button.Visible = true;
            _button.Position = Position;
            _button.Depth = Depth + 1f;

            if (OverTexture != null) {
              _buttonOver = new nProp (OverTexture, Size);
              _buttonOver.Visible = true;
              _buttonOver.Position = Position;
              _buttonOver.Depth = Depth + 2f;
              _button.Listen(Camera, nInputEvent.ENTER, delegate {
            _button.Depth = Depth + 3;
            _buttonOver.Depth = Depth + 2f;
              });
              _buttonOver.Listen(Camera, nInputEvent.EXIT, delegate {
            _button.Depth = Depth + 1;
            _buttonOver.Depth = Depth + 3f;
              });
            }

            if (DownTexture != null) {
              _buttonDown = new nProp (DownTexture, Size);
              _buttonDown.Visible = true;
              _buttonDown.Position = Position;
              _buttonDown.Depth = Depth + 2f;
              _button.Listen(Camera, nInputEvent.DOWN, delegate {
            _buttonDown.Depth = Depth + 1f;
              });
              _buttonDown.Listen(Camera, nInputEvent.UP, delegate {
            _buttonDown.Depth = Depth + 4f;
              });
              _buttonDown.Listen(Camera, nInputEvent.EXIT, delegate {
            _buttonDown.Depth = Depth + 4f;
              });
            }

            if ((Text != null) && (Text != "")) {
              var text = new nText (Size);
              text.Text = Text;
              text.Font = (Font) Resources.Load(Font);
              text.FontSize = FontSize;
              text.Color = Color;
              _text = new nProp (text);
              _text.Visible = true;
              _text.Position = new Vector2(Position[0] - Size[0] / 3.0f, Position[1] + Size[1] / 3.3f);
              _text.Depth = Depth + 0f;
            }

            _button.Listen(Camera, nInputEvent.UP, Action);
              }
        }
예제 #8
0
        void Start()
        {
            _controller = HelloApp.App.Get<GameController>();
              var model = _controller.SceneInfo(14.0f).Model.As<SceneInfoViewModel>();
              _cam = model.Camera;

              var fortune = Fortunes.Next();
              var offset = new Vector2((float) (53 - (int) fortune[2]) * 0.1f, 0f);

              var text = new nText(new Vector2(1.0f, 1.0f));
              text.Font = (Font) Resources.Load("Fonts/vinchard");
              text.FontSize = 0.45f;
              text.Text = (string) fortune[0];
              text.Color = new Color(0.2f, 0.2f, 0.2f);
              var p = new nProp(text);
              p.Visible = true;
              p.Position = new Vector2(-4.0f, -3.5f) + offset;

              text = new nText(new Vector2(1.0f, 1.0f));
              text.Font = (Font) Resources.Load("Fonts/vinchard");
              text.FontSize = 0.35f;
              text.Text = (string) fortune[1];
              text.Color = new Color(0.5f, 0.5f, 0.5f);
              p = new nProp(text);
              p.Visible = true;
              p.Position = new Vector2(-4.0f, -3.0f) + offset;

              /*p = new nProp("pot", new Vector2(2.0f, 2.0f));
              p.Visible = true;
              p.Position = new Vector2(0f, -1.25f);
              p.Depth = 6.0f;
              p.Color = new Color(0.5f, 0.5f, 0.5f);*/

              /*p = new nProp("square-pot", new Vector2(4.5f, 2.0f));
              p.Visible = true;
              p.Position = new Vector2(0f, -1.7f);
              p.Depth = 7.0f;
              p.Color = new Color(0.5f, 0.5f, 0.5f);*/

              p = new nProp("oval-pot", new Vector2(3.85f, 1.5f));
              p.Visible = true;
              p.Position = new Vector2(-0.15f, -1.47f);
              p.Scale = new Vector2(1.2f, 1.1f);
              p.Depth = 7.0f;
              p.Color = new Color(0.5f, 0.5f, 0.5f);

              b = new nButton() {
            Text = "Return to menu",
            Font = "Fonts/vinchard",
            Position = new Vector2(6.0f, 5.5f),
            FontSize = 0.5f,
            Camera = _cam,
            Size = new Vector2(4.0f, 1.0f),
            Color = new Color(0.2f, 0.2f, 0.2f),
            Texture = "Menu.button.0",
            Action = delegate {
              _controller.Index().Activate();
            }
              };
              b.Manifest();

              b2 = new nButton() {
            Text = "Download this Bonsai",
            Font = "Fonts/vinchard",
            Position = new Vector2(-6.7f, 5.5f),
            FontSize = 0.5f,
            Camera = _cam,
            Size = new Vector2(4.0f, 1.0f),
            Color = new Color(0.2f, 0.2f, 0.2f),
            Texture = "Menu.button.0",
              };
              b2.Action = delegate {
            StartCoroutine(WaitingForSS());
              };
              b2.Manifest();

              bLeaf.MagicOffset = -1f;
              var tree = HelloApp.App.Get<TreeController>().ForceTreeRedraw().Model.As<bTreeTestViewModel>();
              tree.Data.TreeView.Tree.Position = new Vector2(0f, -1f);
        }