示例#1
0
文件: UIRocker.cs 项目: uiopsczc/Test
        public void Init(string prefabPath, Transform parentTransform, UIRockerInput uiRockerInput)
        {
            base.Init();
            this.graphicComponent.SetPrefabPath(prefabPath ?? UIRockerConst.UIRock_Prefab_Path);
            this.graphicComponent.SetParentTransform(parentTransform);
            this.uiRockerInput = uiRockerInput;

            this.AddListener <float, float>(null, GlobalEventNameConst.Update, Update);
        }
示例#2
0
        public static void Test()
        {
            UIRockerTest.unitGameObject = GameObject.Find("UITestPanel").NewChildWithImage("unit").gameObject;
            UIRockerTest.unitText       =
                UIRockerTest.unitGameObject.NewChildWithText("state", null, 40, Color.black, TextAnchor.MiddleCenter,
                                                             null);
            UIRockerTest.unitRectTransform = UIRockerTest.unitGameObject.GetComponent <RectTransform>();
            UIRockerTest.rockerInput       = Client.instance.AddChild <UIRockerInput>(null);
            UIRockerTest.uiRocker          = Client.instance.AddChild <UIRocker>(null, null,
                                                                                 GameObject.Find("UITestPanel").transform,
                                                                                 UIRockerTest.rockerInput);

            Client.instance.AddListener <float, float>(null, UIRockerTest.rockerInput.eventNameMovePCT,
                                                       UIRockerTest.MovePct);
            Client.instance.AddListener(null, UIRockerTest.rockerInput.eventNameMoveStop, UIRockerTest.MoveStop);
        }