Esempio n. 1
0
        /// <summary>
        /// 用Data数据对Menu进行初始化
        /// </summary>
        /// <param name="data"></param>
        public void BuildMenu(BlockMenuData data)
        {
            menuName = data.name;

            BlockPanel panel = null;

            panel     = CreatePanel(data.rootPanel, null);
            rootPanel = panel;
        }
Esempio n. 2
0
        public void Init()
        {
            for (int i = 0; i < menuDataList.Count; i++)
            {
                string str = menuDataList[i].text;

                BlockMenuData data = JsonUtil.Deserialize <BlockMenuData>(str);

                CreateMenu(data);
            }
        }
Esempio n. 3
0
        public void Init()
        {
            for (int i = 0; i < menuDataList.Count; i++)
            {
                TextAsset t = menuDataList[i];
                if (t == null)
                {
                    continue;
                }

                string str = t.text;

                BlockMenuData data = JsonUtil.Deserialize <BlockMenuData>(str);

                CreateMenu(data);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 用数据创建一个面板
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public bool CreateMenu(BlockMenuData data)
        {
            if (menuDic.ContainsKey(data.name))
            {
                // 已经有重名Menu
                Debug.Log("已经存在同名Menu!");
                return(false);
            }

            GameObject obj = PrefabUtils.CreateGameObjectToParent(null, menuPrefab);

            obj.name = "Menu[" + data.name + "]";
            BlockMenu menu = obj.GetComponent <BlockMenu>();

            menuDic.Add(data.name, menu);

            menu.BuildMenu(data);

            return(true);
        }