private void CompoundRotateScaleSet() { var strip = new nStrip(new Vector2[] { new Vector2(1, 1), new Vector2(1, 0), new Vector2(1, -1), new Vector2(-2, -1), new Vector2(-2, 1), }, new float[] { 0.05f, 0.1f, 0.2f, 0.2f, 0.05f }); var p = new nProp(strip); p.Visible = true; p.Color = new Color(1.0f, 0.0f, 0.4f, 1.0f); p.Scale = new Vector2(1.0f, 1.0f); p.Rotation = 0.0f; p.Position = new Vector2(-4.0f, -3f); p = new nProp(strip); p.Visible = true; p.Color = new Color(0.0f, 0.0f, 0.0f, 1.0f); p.Scale = new Vector2(0.4f, 0.4f); p.Rotation = 0.0f; p.Position = new Vector2(0.0f, -3f); p = new nProp(strip); p.Visible = true; p.Color = new Color(0.0f, 1.0f, 1.0f, 1.0f); p.Scale = new Vector2(1.0f, 1.0f); p.Rotation = 99.0f; p.Position = new Vector2(4.0f, -3f); }
public void Add(nProp p) { if (!_props.Contains(p)) { _props.Add(p); _last = p; } }
public void Destroy() { if (_visible) { _visible = false; _button.Visible = false; _button = null; _text.Visible = false; _text = null; } }
private void SimpleStrip(Vector2 pos, Vector2 start, Vector2 end, float size, Texture t) { var strip = new nStrip(new Vector2[] { start, end }, new float[] { size, size }); strip.Texture = t; var p = new nProp(strip); p.Visible = true; p.Color = new Color(1.0f, 1.0f, 0.0f, 1.0f); p.Scale = new Vector2(1.0f, 1.0f); p.Rotation = 0.0f; p.Position = pos; }
private void DrawArrow(float x1, float y1, float x2, float y2) { var strip = new nStrip(new Vector2[2] { new Vector2(x1, y1), new Vector2(x2, y2) }, new float[2] { 0.01f, 0.01f }); var p = new nProp(strip); p.Visible = true; p.Color = new Color(0.8f, 0.8f, 0.9f); _helps.Add(p); }
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)); }
private void AddLineSegment(nQuad q, Vector2 start, Vector2 end, float w1, float w2) { var p = new nProp(q); p.Visible = true; p.Listen(_cam, nInputEvent.ENTER, delegate (nPropEvent e) { e.Prop.Color = new Color(1.0f, 1.0f, 0.0f, 0.3f); }); p.Listen(_cam, nInputEvent.EXIT, delegate (nPropEvent e) { e.Prop.Color = new Color(1.0f, 1.0f, 1.0f, 1.0f); }); nStrip.PopulateLineSegment(p.Vertices, start, end, w1, w2); p.PushVertexUpdate(); }
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; }
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); }
private void SimpleLineTest(Vector2 start, Texture t = null) { var strip = new nStrip(new Vector2[] { new Vector2(0, 0), new Vector2(1, 0), new Vector2(2, 0), new Vector2(3, 0), new Vector2(4, 0), new Vector2(5, 0), new Vector2(6, 0), new Vector2(7, 0), new Vector2(8, 0) }, new float[] { 0.1f, 0.1f, 0.1f, 0.2f, 0.0f, 0.5f, 0.02f, 0.02f, 0.01f }); strip.Texture = t; var p = new nProp(strip); p.Visible = true; p.Color = new Color(0.0f, 0.0f, 1.0f, 1.0f); p.Scale = new Vector2(1.0f, 1.0f); p.Position = start; }
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); } }
/** Render this leaf and add it to the set of items */ public void Render(List<nProp> elements, bool force) { if (_dead) return; if (!Growing()) return; if ((Display == null) || (force)) { if (Display != null) { Display.Visible = false; Display = null; } var quad = new nQuad("leaf", new Vector2(1.0f, 1.0f)); quad.Texture = Texture; Display = new nProp(quad); Display.Visible = true; Display.Vertices = new Vector3[4] { new Vector3(1.0f, 1.0f, 0f), new Vector3(1.0f, 0f, 0f), new Vector3(0f, 1.0f, 0f), new Vector3(0f, 0f, 0f) }; Display.PushVertexUpdate(); Display.Rotation = Parent.FullAngle + 90f + Angle; Display.Depth = 2.0f; Display.Color = new Color(1f, 1f, 1f, 0.5f); var sSize = 0.05f; var r = new System.Random(); Scatter = new Vector2(sSize * (float)r.NextDouble(), sSize * (float)r.NextDouble()); } var angle = Parent.FullAngle; var o = Offset > Parent.Length ? Parent.Length : Offset; if (o < 0f) o = 0f; float x = (float) Math.Sin(angle * Math.PI / 180) * (Parent.Length - o); float y = (float) Math.Cos(angle * Math.PI / 180) * (Parent.Length - o); var start = Parent.Base + new Vector2(x, y) + Scatter; start[1] += MagicOffset; Display.Scale = new Vector2(Size, Size); Display.Position = start; //var offset = new Vector2(y, -x); //offset.Normalize(); //offset = offset * Size; //var end = start + offset; //nStrip.PopulateLineSegment(Display.Vertices, start, end, Size, Size); //Display.PushVertexUpdate(); }
/** * Add a prop to the layer * <p> * Many props can be added under a single type; or a single one can. * For example, you can add a hundred 'star' props by adding them with * the same id, and one player prop. */ public void Add(int type, nProp p) { }
/** Remove a prop for the layer */ public void Remove(nProp p) { }
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); } }
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); }
/** Destroy this branch */ public void Die() { if (_display != null) { _display.Visible = false; _display = null; } Parent = null; _dead = true; foreach (var l in Leaves) { l.Die(); } if (NextSegment != null) NextSegment.Die(); foreach (var b in Branches) { b.Die(); } }
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); }
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"); }); }
private void DrawGround() { var ground = new nProp("ground", new Vector2(18f, 5f)); ground.Visible = true; ground.Position = new Vector2(0f, -3.64f); ground.Depth = 8f; }
/** Create a series of line segments as props for this and all sub branches */ public void Render(List<nProp> elements, nCamera camera, bool force) { if (_dead) return; if (camera == null) return; /* Do we have a prop for this branch yet? If not, make one */ if ((_display == null) || (force)) { if (_display != null) { _display.Visible = false; _display = null; } if (camera != null) { var t = (Texture)Resources.Load("test.line.3"); var q = new nQuad("Tree", new Vector2(1f, 1f)); q.Texture = t; _display = new nProp(q); _display.Visible = true; _display.Data = this; _display.Depth = 3.0f; _display.ClearEventListeners(camera, nInputEvent.ENTER); _display.ClearEventListeners(camera, nInputEvent.EXIT); _display.Listen(camera, nInputEvent.ENTER, delegate { if (Tree.EditMode) _display.Color = new Color(0f, 1f, 0f, 0.5f); }); _display.Listen(camera, nInputEvent.EXIT, delegate { _display.Color = Color.white; }); _display.Listen(camera, nInputEvent.UP, delegate { if (Tree.EditMode) Hello.HelloApp.App.Get<TreeController>().RemoveBranch(this); }); } } /** Update this to match the actual branch */ var _base = Base; var _tip = Tip; var _parentWidth = Parent != null ? Parent.WidthAtPoint(Offset) : Width; var _baseWidth = _parentWidth < Width ? _parentWidth : Width; // Segments must join up cleanly if (IsSegment) _baseWidth = _parentWidth; var _tipWidth = TipWidth; nStrip.PopulateLineSegment(_display.Vertices, _base, _tip, _baseWidth, _tipWidth); _display.PushVertexUpdate(); /** Collect this */ elements.Add(_display); /** Collect segments */ var segs = new List<bTreeBranch>(); CollectSegments(segs); foreach (var s in segs) { if (s != this) { s.Render(elements, camera, force); } } /** Collect branches */ foreach (var b in Branches) { b.Render(elements, camera, force); } /** Collect leaves */ foreach (var l in Leaves) { l.Render(elements, force); } }
private void DrawHelp(bool show) { if (show) { DrawHelpText("Welcome to bonsai bloom! You've got 90 days to grow your bonsai...", 0.4f, -5.5f, 4.5f); DrawHelpText("This shows you how much time\nhas passed in the game so far", 0.3f, 4.5f, 1.9f); DrawHelpText("You can control the speed of time\nby using these buttons!", 0.3f, -2f, 2.7f); DrawHelpText("The edit button pauses\n the game and lets\n you trim branches", 0.3f, -8f, 2.3f); DrawHelpText("Your tree will start growing right here!", 0.3f, -7f, -1.5f); DrawHelpText("Ready? Click here to start!", 0.4f, 0f, 0f); DrawArrow(2.9f, -0.5f, 3.3f, -1.3f); DrawArrow(5f, 2.0f, 4.7f, 2.6f); DrawArrow(-2.25f, 2.3f, -3.5f, 2.95f); DrawArrow(-6.0f, 2.30f, -5.4f, 2.9f); DrawArrow(-2.8f, -1.8f, -0.3f, -2.85f); var p = new nProp("startTree", new Vector2(1.8f, 1.8f)); p.Visible = true; p.Position = new Vector2(4f, -1.8f); p.Listen(_cam, nInputEvent.UP, delegate { DrawHelp(false); started = true; }); _helps.Add(p); } else { foreach(var p in _helps) { p.Visible = false; } } }
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, nInputEvent.UP, delegate (nPropEvent 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, nInputEvent.UP, delegate (nPropEvent 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; _props[5].Listen(_cam, nInputEvent.ENTER, delegate (nPropEvent e) { e.Prop.Color = new Color(1.0f, 1.0f, 0.0f, 1.0f); }); _props[5].Listen(_cam, nInputEvent.EXIT, delegate (nPropEvent e) { e.Prop.Color = new Color(1.0f, 1.0f, 1.0f, 1.0f); }); /* Load a transparent prop set and make sure transparency overlays work */ var p = new nProp("lovie-foliage", new Vector2(2.0f, 2.0f)); p.Visible = true; p.Position = new Vector2(4.0f, 2.0f); p.Depth = 1; p = new nProp("nujiper-foliage", new Vector2(2.0f, 2.0f)); p.Visible = true; p.Position = new Vector2(4.5f, 2.5f); p.Color = new Color(1.0f, 0.0f, 0.0f, 0.5f); /* load a quad and distort it*/ var q = new nQuad(new Vector2(1.0f, 1.0f)); q.Texture = (Texture) Resources.Load("test.quad.1"); q.Layout[0][0] = 4.0f; q.Layout[0][1] = 4.0f; AddLineSegment(q, new Vector2(-4, -3), new Vector2(-3, -3), 1.0f, 0.8f); AddLineSegment(q, new Vector2(-3, -3), new Vector2(-2, -3), 0.8f, 0.6f); AddLineSegment(q, new Vector2(-2, -3), new Vector2(-1, -3), 0.6f, 0.4f); AddLineSegment(q, new Vector2(-1, -3), new Vector2(0, -3), 0.4f, 0.2f); AddLineSegment(q, new Vector2(0, -3), new Vector2(1, -3), 0.2f, 0.1f); AddLineSegment(q, new Vector2(1, -3), new Vector2(2, -3), 0.1f, 0.05f); AddLineSegment(q, new Vector2(2, -3), new Vector2(3, -3), 0.05f, 0.01f); }
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); }