void Start() { var controller = HelloApp.App.Get <HomeController>(); var model = controller.SceneInfo().Model.As <SceneInfoViewModel>(); model.BackButton.Manifest(); _cam = model.Camera; /* load a quad */ _quads[0] = new nQuad(new Vector2(1.0f, 1.0f)); _quads[0].Texture = (Texture)Resources.Load("test.quad.1"); /* create a couple of props from the quad */ _props[0] = new nProp(_quads[0]); _props[0].Visible = true; _props[0].Position = new Vector2(0, 0); _props[0].Listen(_cam, delegate(nProp prop) { nLog.Debug("Got a click on 0!"); }); _props[1] = new nProp(_quads[0]); _props[1].Visible = true; _props[1].Position = new Vector2(2, 0); _props[1].Scale = new Vector2(0.5f, 0.5f); _props[2] = new nProp(_quads[0]); _props[2].Visible = true; _props[2].Position = new Vector2(0, 2); _props[2].Rotation = 45.0f; _props[2].Listen(_cam, delegate(nProp prop) { nLog.Debug("Got a click on 2!"); }); _props[3] = new nProp(_quads[0]); _props[3].Visible = true; _props[3].Position = new Vector2(2, 2); _props[3].Depth = 0; _props[4] = new nProp(_quads[0]); _props[4].Visible = true; _props[4].Position = new Vector2(2.5f, 2.5f); _props[4].Depth = 1; _props[5] = new nProp("test.quad.1", new Vector2(2.0f, 2.0f)); _props[5].Visible = true; _props[5].Position = new Vector2(-3, 0); _props[5].Scale = new Vector2(0.5f, 2.0f); _props[5].Rotation = -15.0f; }
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 UnityEngine.Vector2(Position[0] - Size[0] / 3.0f, Position[1] + Size[1] / 3.3f); _text.Depth = Depth + 0f; } _button.Listen(Camera, nInputEvent.UP, Action); } }
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"); }); }
public void Destroy() { if (_visible) { _visible = false; _button.Visible = false; _button = null; _text.Visible = false; _text = null; } }