public override void Init()
    {
        base.Init();

        //添加子窗口
        var subwin = new SubWindow_Demo2(this.Transform.Find("SubWindow"));

        subwin.Init();

        this.AddSubWindow("subwin1", subwin);
        //注册消息监听
        RegisterAction("rotation", OnMsg_Rotation);
        //01按钮
        btn_01.onClick.AddListener(() =>
        {
            this.Close();
            ScreenViewManager.Inst.MainLayer.BeginNavTo(ScreenViewEnum.Main);
        });

        //02按钮
        btn_02.onClick.AddListener(() =>
        {
            var data = WindowData.Create("testkey");
            data.AddData("testkey", "testvalue");
            this.OpenSubWindow("subwin1", data);
        });
    }
Example #2
0
    public AWindow(Transform transform)
    {
        this.Transform       = transform;
        this.TempData        = WindowData.Create();
        subWindowsDictionary = new Dictionary <string, SubWindow>();

        UITools.AutoSetTransformPath(this);
    }
Example #3
0
    private void save()
    {
        if (tempDialData == null)
        {
            return;
        }
        var data = WindowData.Create("AddDial");

        data.AddData("key", tempDialData);
        UIManager.Inst.SendMessage((int)WinEnum.Win_Menu, data);
    }
    public override void Init()
    {
        base.Init();

        //提示
        var isCodeHotfix = GameObject.Find("BDFrame").GetComponent <BDLauncher>().IsCodeHotfix;

        text_hotfixState.text = isCodeHotfix ? "热更模式:开" : "热更模式:关";

        //demo1: screenview 切换
        this.btn_01.onClick.AddListener(() =>
        {
            ScreenViewManager.Inst.MainLayer.BeginNavTo("demo1");
        });

        //demo2: ui window基本操作
        this.btn_02.onClick.AddListener(() =>
        {
            ScreenViewManager.Inst.MainLayer.BeginNavTo("demo2");

            //向demo2窗口发消息
            var d = WindowData.Create();
            d.AddData("rotation", UnityEngine.Random.Range(-359, 359));
            UIManager.Inst.SendMessage((int)WinEnum.Win_Demo2, d);
        });

        //demo3: uimvc模式
        this.btn_03.onClick.AddListener(() =>
        {
            ScreenViewManager.Inst.MainLayer.BeginNavTo("demo3");
        });

        //demo4: uitools使用
        this.btn_04.onClick.AddListener(() =>
        {
            UIManager.Inst.LoadWindows((int)WinEnum.Win_Demo4);
            UIManager.Inst.ShowWindow((int)WinEnum.Win_Demo4);
        });
        //demo5: sqlite 查询
        this.btn_05.onClick.AddListener(() =>
        {
            var ds = SqliteHelper.DB.GetTableRuntime <Hero>().Where("id > 1").ToSearch();
            foreach (var d in ds)
            {
                Debug.Log(JsonMapper.ToJson(d));
            }
        });
    }
    private void loadIcons()
    {
        //加载数据
        var dialTable = SqliteHelper.DB.GetTableRuntime().ToSearch <Dial>();

        foreach (var d in dialTable)
        {
            //Debug.LogError(JsonMapper.ToJson(d));
            var o  = CResources.Load <GameObject>("Views/EnteranceIcon");
            var go = GameObject.Instantiate(o);
            go.transform.parent     = tf_Content;
            go.transform.localScale = Vector3.one;
            var subIcon = new CUIIcon(go.transform);
            subIcon.Init();
            var data = WindowData.Create("IconsData");
            data.AddData("IconsData", d);
            subIcon.Open(data);
        }
    }
Example #6
0
 public override void Init()
 {
     base.Init();
     btn_Icon = this.Transform.GetComponent <Button>();
     img_Icon = this.Transform.GetComponent <Image>();
     btn_Icon.onClick.AddListener(() =>
     {
         //点击进入对应的转盘
         ScreenViewManager.Inst.MainLayer.BeginNavTo(panelName);
         var data = WindowData.Create("defaultAdd");
         data.AddData("key", dialInfo);
         if (!isDefaultAdd)
         {
             UIManager.Inst.SendMessage((int)WinEnum.Win_Game, data);
         }
         else
         {
         }
     });
 }
    public override void Init()
    {
        base.Init();

        //提示
        var isCodeHotfix = GameObject.Find("BDFrame").GetComponent <BDLauncher>().IsCodeHotfix;

        text_hotfixState.text = isCodeHotfix ? "热更模式:开" : "热更模式:关";

        //demo1: screenview 切换
        this.btn_01.onClick.AddListener(() => { ScreenViewManager.Inst.MainLayer.BeginNavTo("demo1"); });

        //demo2: ui window基本操作
        this.btn_02.onClick.AddListener(() =>
        {
            ScreenViewManager.Inst.MainLayer.BeginNavTo("demo2");

            //向demo2窗口发消息
            var d = WindowData.Create();
            d.AddData("rotation", UnityEngine.Random.Range(-359, 359));
            UIManager.Inst.SendMessage((int)WinEnum.Win_Demo2, d);
        });

        //demo3: uimvc模式
        this.btn_03.onClick.AddListener(() => { ScreenViewManager.Inst.MainLayer.BeginNavTo("demo3"); });

        //demo4: uitools使用
        this.btn_04.onClick.AddListener(() =>
        {
            UIManager.Inst.LoadWindows((int)WinEnum.Win_Demo4);
            UIManager.Inst.ShowWindow((int)WinEnum.Win_Demo4);
        });
        //demo5: sqlite 查询
        this.btn_05.onClick.AddListener(() =>
        {
            var ds = SqliteHelper.DB.GetTableRuntime().Where("id > 1").ToSearch <Hero>();

            foreach (var d in ds)
            {
                Debug.Log(JsonMapper.ToJson(d));
            }
        });
        //demo6:资源加载
        this.btn_06.onClick.AddListener(() =>
        {
            //1.同步加载
            var go = BResources.Load <GameObject>("Windows/window_demo1");

            //2.异步加载单个
            var id = BResources.AsyncLoad <GameObject>("Windows/window_demo1", (b, o) => { });
//            //取消任务
//            BResources.LoadCancel(id);6
//
//          //3.异步加载多个
            BResources.AsyncLoad(new List <string>()
            {
                "Windows/window_demo1", "Windows/window_demo2"
            },
                                 (i, i2) => { Debug.Log(string.Format("进度 {0} / {1}", i, i2)); }, (map) =>
            {
                BDebug.Log("加载全部完成,资源列表:");
                foreach (var r in map)
                {
                    BDebug.Log(string.Format("--> {0} : {1}", r.Key, r.Value.name));
                    GameObject.Instantiate(r.Value);
                }
            });
        });

        this.btn_07.onClick.AddListener(() =>
        {
            var path = Application.streamingAssetsPath;

            var t = VersionContorller.Start("http://127.0.0.1", path,
                                            (i, j) =>
            {
                Debug.LogFormat("资源更新进度:{0}/{1}", i, j);
            },
                                            (error) =>
            {
                Debug.LogError("错误:" + error);
            });
            //var result = t.Result;
            Debug.Log("下载状态返回:");
        });
    }
    public override void Init()
    {
        base.Init();

        //提示
//        var isCodeHotfix = GameObject.Find("BDFrame").GetComponent<BDLauncher>().IsCodeHotfix;
//        text_hotfixState.text = isCodeHotfix ? "热更模式:开" : "热更模式:关";

        //demo1: screenview 切换
        //代码:
        //Game@hotfix/demo1
        this.btn_01.onClick.AddListener(() => { ScreenViewManager.Inst.MainLayer.BeginNavTo("demo1"); });

        //demo2: ui window基本操作
        //代码:
        //Game@hotfix/demo2
        this.btn_02.onClick.AddListener(() =>
        {
            ScreenViewManager.Inst.MainLayer.BeginNavTo("demo2");

            //向demo2窗口发消息
            var d = WindowData.Create("rotation");
            d.AddData("rotation", UnityEngine.Random.Range(-359, 359));
            UIManager.Inst.SendMessage((int)WinEnum.Win_Demo2, d);
        });

        //demo3: uimvc模式
        //代码:
        //Game@hotfix/demo3
        this.btn_03.onClick.AddListener(() => { ScreenViewManager.Inst.MainLayer.BeginNavTo("demo3"); });

        //demo4: uitools使用
        //代码:
        //Game@hotfix/demo4
        this.btn_04.onClick.AddListener(() =>
        {
            UIManager.Inst.LoadWindows((int)WinEnum.Win_Demo4);
            UIManager.Inst.ShowWindow((int)WinEnum.Win_Demo4);
        });
        //demo5: sqlite 查询
        this.btn_05.onClick.AddListener(() =>
        {
            var ds = SqliteHelper.DB.GetTableRuntime().Where("id > 1").ToSearch <Hero>();

            foreach (var d in ds)
            {
                Debug.Log(JsonMapper.ToJson(d));
            }
        });
        //demo6:资源加载
        this.btn_06.onClick.AddListener(() =>
        {
            //1.同步加载
            var go = BResources.Load <GameObject>("Windows/window_demo1");

            //2.异步加载单个
            var id = BResources.AsyncLoad <GameObject>("Windows/window_demo1", (o) => { });

            //3.异步加载多个
            var list = new List <string>()
            {
                "Windows/window_demo1", "Windows/window_demo2"
            };
            BResources.AsyncLoad(list,
                                 (i, i2) =>
            {
                Debug.Log(string.Format("进度 {0} / {1}", i, i2));
            },
                                 (map) =>
            {
                BDebug.Log("加载全部完成,资源列表:");
                foreach (var r in map)
                {
                    BDebug.Log(string.Format("--> {0} : {1}", r.Key, r.Value.name));
                    GameObject.Instantiate(r.Value);
                }
            });
        });

        //代码:
        //Game@hotfix/demo_Manager_AutoRegister_And_Event
        this.btn_07.onClick.AddListener(() =>
        {
            var path = Application.persistentDataPath;

            VersionContorller.Start(UpdateMode.Repair, "http://127.0.0.1", path,
                                    (i, j) =>
            {
                Debug.LogFormat("资源更新进度:{0}/{1}", i, j);
            },
                                    (error) =>
            {
                Debug.LogError("错误:" + error);
            });
        });


        //发送消息机制
        this.btn_08.onClick.AddListener(() =>
        {
            DemoEventManager.Inst.Do(DemoEventEnum.TestEvent2);
        });
    }
Example #9
0
 public AWindow(string path)
 {
     resourcePath         = path;
     this.TempData        = WindowData.Create();
     subWindowsDictionary = new Dictionary <string, SubWindow>();
 }