public TestBase(DeviceOrientation orientation) { Director.Instance.DeviceOrientation = orientation; SizeF s = Director.Instance.WinSize; Label label = new Label(ToString(), "Arial", 32); AddChild(label, 100); label.SetPosition(s.Width / 2f, s.Height - 50); MenuItemImage item1 = new MenuItemImage("b1.png", "b2.png"); item1.Click += OnBack; MenuItemImage item2 = new MenuItemImage("r1.png", "r2.png"); item2.Click += OnRestart; MenuItemImage item3 = new MenuItemImage("f1.png", "f2.png"); item3.Click += OnForward; Menu menu = new Menu(item1, item2, item3); menu.SetPosition(PointF.Empty); float windowWidth = Director.Instance.WinSize.Width; item1.SetPosition(windowWidth / 2 - 100, 30); item2.SetPosition(windowWidth / 2, 30); item3.SetPosition(windowWidth / 2 + 100, 30); AddChild(menu, 5000); }
private void Callback3(CocosNode sender, object data) { Console.WriteLine("callback 3 called from:{0} with data:{1}", sender, data); SizeF s = Director.Instance.WinSize; Label label = new Label("callback 3 called", "Marker Felt", 16); label.SetPosition(s.Width / 4 * 3, s.Height / 2); AddChild(label, 4); }
private void Callback2(CocosNode sender) { Console.WriteLine("callback 2 called from: " + sender.ToString()); SizeF s = Director.Instance.WinSize; Label label = new Label("callback 2 called", "Marker Felt", 16); label.SetPosition(s.Width / 4 * 2, s.Height / 2); AddChild(label, 4); }
private void Callback1() { Console.WriteLine("callback 1 called"); SizeF s = Director.Instance.WinSize; Label label = new Label("callback 1 called", "Marker Felt", 16); label.SetPosition(s.Width / 4 * 1, s.Height / 2); AddChild(label, 4); }