//unity private void Start() { //set init values difficulty = 1; #if UNITY_WEBGL && !UNITY_EDITOR float sensitivity = 0.55f; #else float sensitivity = 0.5f; #endif bool sound = false; //setup control #if UNITY_ANDROID && !UNITY_EDITOR control = gameObject.AddComponent <GyroControl>(); uiManager = new UIWithTaps(UIManagerFactory.getInstance().CreateBig()); #else control = gameObject.AddComponent <SliderControl>(); // uiManager = new UIWithKeyHandler(UIManagerFactory.getInstance().Create()); uiManager = new UIWithTaps(UIManagerFactory.getInstance().CreateBig()); #endif control.SetSensitivity(sensitivity); //setup physics physics = new GamePhysics(); physics.SetDifficulty(difficulty); //setup score score = new GameScore(); score.SetDifficulty(difficulty); uiManager.onMenuCommand += OnMenuCommand; uiManager.Initialize(difficulty, sound, sensitivity); //uiManager.MakeFlexible(true); soundManager.Play(sound); PauseGame(true); }
//IHSUIComponent widget; // Use this for initialization void Start() { manager = UIManagerFactory.CreateDefaultUIManager(); manager.Init(this.transform); panel = manager.CreatePanel <DemoPanel1>("panel1", "PANEL 1"); panel2 = manager.CreatePanel <DemoPanel1>("panel1", "PANEL 2"); panel3 = manager.CreatePanel <DemoPanel1>("panel1", "PANEL 3"); panel4 = manager.CreatePanel <DemoPanel1>("panel1", "PANEL 4"); DemoWidgetSidebar widget = manager.CreateWidget <DemoWidgetSidebar>("sidebar", panel2, panel2.transform); widget.Init(DemoWidgetSidebar.WidgetType.Toggle); widget.AddItem(new DemoWidgetSidebar.SideBarWidgetSelectItem("签到", () => { Debug.Log("sdf"); })); widget.AddItem(new DemoWidgetSidebar.SideBarWidgetSelectItem("抽签", () => { Debug.Log("sdfsdf"); })); widget.AddItem(new DemoWidgetSidebar.SideBarWidgetSelectItem("开始", () => { Debug.Log("sdfsdfsdf"); })); //manager.CreateWidget<DemoWidgetSidebar>("sidebar", panel3, panel3.transform); manager.DestroyPanel(panel4); StartCoroutine(Test()); }