Esempio n. 1
0
    private static void _FindLabelLocalization(KBuild_NGUI uiBuilder)
    {
        // 收集UiLabel的字符串
        //if (uiBuilder.WindowObject.GetComponent<UIPanel>() == null)
        {
            // 读取UIPanel的depth, 遍历所有UI控件,将其depth加上UIPanel Depth, 以此设置层级关系
            // 如PanelRoot Depth填10,  子控件填0,1,2   打包后,子控件层级为 10 << 5 | 1 = 320, 321, 322
            //foreach (UIWidget uiWidget in uiBuilder.WindowObject.GetComponentsInChildren<UIWidget>(true))
            //{
            //uiWidget.depth = (uiBuilder.PanelRoot.depth + 15) << 5 | (uiWidget.depth + 15);  // + 15是为了杜绝负数!不要填-15以上的
            //}

            // UILabel 多语言
            //foreach (UILabel uiLabel in uiBuilder.WindowObject.GetComponentsInChildren<UILabel>(true))
            //{
            //    //uiLabel.depth = (uiBuilder.PanelRoot.depth + 15) << 5 | (uiLabel.depth + 15);

            //    // 收集字符串
            //    var match = TemplateRegex.Match(uiLabel.text);
            //    if (match.Groups.Count > 1)  // 捕获组1, 中括号内
            //    {
            //        var val = match.Groups[1].Value.Trim();
            //        if (!string.IsNullOrEmpty(val))
            //        {
            //            uiBuilder.UILabelStrings.Add(val, uiBuilder.UIName);
            //            uiBuilder.UILabelStrings2.Add(val, uiBuilder.UIName);
            //        }
            //    }
            //    //if (!uiLabel.text.StartsWith("_"))

            //}
        }
    }
Esempio n. 2
0
    public static void ExportAllUI()
    {
        var buildUI = new KBuild_NGUI();

        buildUI.IsBuildAll = true;
        KResourceBuilder.ProductExport(buildUI);
    }
Esempio n. 3
0
    // 针对当前打开的单个UI
    static void Custom_ExportCurrentUI(KBuild_NGUI uiBuilder, string uiScenepath, string uiName,
        GameObject objToBuild)
    {
        bool reBuildPanel = KAssetVersionControl.TryCheckNeedBuildWithMeta(uiScenepath);

        KDependencyBuild.BuildGameObject(objToBuild, KBuild_NGUI.GetBuildRelPath(uiName), reBuildPanel);

        if (reBuildPanel)
            KAssetVersionControl.TryMarkBuildVersion(uiScenepath);

        _FindLabelLocalization(uiBuilder);
    }
Esempio n. 4
0
    // 针对当前打开的单个UI
    static void Custom_ExportCurrentUI(KBuild_NGUI uiBuilder, string uiScenepath, string uiName,
                                       GameObject objToBuild)
    {
        bool reBuildPanel = KAssetVersionControl.TryCheckNeedBuildWithMeta(uiScenepath);

        KDependencyBuild.BuildGameObject(objToBuild, KBuild_NGUI.GetBuildRelPath(uiName), reBuildPanel);

        if (reBuildPanel)
        {
            KAssetVersionControl.TryMarkBuildVersion(uiScenepath);
        }

        _FindLabelLocalization(uiBuilder);
    }
Esempio n. 5
0
 static void Custom_BeginExport(KBuild_NGUI uiBuilder)
 {
     // 读取字符串
     //uiBuilder.UILabelStrings.Clear();
     //if (File.Exists(UILabelStringsFile))
     //{
     //    uiBuilder.UIStringsFile = KTabFile.LoadFromFile(UILabelStringsFile);
     //    for (int row = 1; row < uiBuilder.UIStringsFile.GetHeight(); ++row)
     //    {
     //        // 获取当前UI名~
     //        uiBuilder.UILabelStrings.Add(uiBuilder.UIStringsFile.GetString(row, "_String_"), uiBuilder.UIName);
     //    }
     //}
     //else
     //{
     //    uiBuilder.UIStringsFile = new KTabFile();
     //    uiBuilder.UIStringsFile.NewColumn("_String_");
     //}
 }
Esempio n. 6
0
 static void Custom_BeginExport(KBuild_NGUI uiBuilder)
 {
     // 读取字符串
     //uiBuilder.UILabelStrings.Clear();
     //if (File.Exists(UILabelStringsFile))
     //{
     //    uiBuilder.UIStringsFile = KTabFile.LoadFromFile(UILabelStringsFile);
     //    for (int row = 1; row < uiBuilder.UIStringsFile.GetHeight(); ++row)
     //    {
     //        // 获取当前UI名~
     //        uiBuilder.UILabelStrings.Add(uiBuilder.UIStringsFile.GetString(row, "_String_"), uiBuilder.UIName);
     //    }
     //}
     //else
     //{
     //    uiBuilder.UIStringsFile = new KTabFile();
     //    uiBuilder.UIStringsFile.NewColumn("_String_");
     //}
 }
Esempio n. 7
0
    public static void ExportUIMenu()
    {
        if (ExportUIMenuEvent != null)
        {
            ExportUIMenuEvent();
        }

        KBuild_NGUI uiBuild = new KBuild_NGUI();

        uiBuild.IsBuildAll = false;
        if (!uiBuild.CheckUI(true))
        {
            return;
        }

        uiBuild.BeforeExport();
        uiBuild.ExportCurrentUI();
        uiBuild.AfterExport();
    }
Esempio n. 8
0
    // big export
    private static void Custom_EndExport(KBuild_NGUI uiBuilder)
    {
        //KI18NItems exportHashSet;
        //if (uiBuilder.IsBuildAll)
        //{
        //    exportHashSet = uiBuilder.UILabelStrings2;  // 使用全局的,精确的
        //}
        //else
        //    exportHashSet = uiBuilder.UILabelStrings;  // 在原来的基础上

        //int srcFileRowCount = uiBuilder.UIStringsFile.GetHeight();
        //uiBuilder.UIStringsFile = new KTabFile();
        //uiBuilder.UIStringsFile.NewColumn("_String_");
        //uiBuilder.UIStringsFile.NewColumn("_Sources_");

        ////int rowCount = 1;
        //foreach (var kv in exportHashSet.Items)
        //{
        //    var rowCount = uiBuilder.UIStringsFile.NewRow();
        //    uiBuilder.UIStringsFile.SetValue<string>(rowCount, "_String_", kv.Key);
        //    uiBuilder.UIStringsFile.SetValue<string>(rowCount, "_Sources_", string.Join("|", kv.Value.ToArray()));
        //}
        //uiBuilder.UIStringsFile.Save(UILabelStringsFile);
    }
Esempio n. 9
0
    // big export
    private static void Custom_EndExport(KBuild_NGUI uiBuilder)
    {
        //KI18NItems exportHashSet;
        //if (uiBuilder.IsBuildAll)
        //{
        //    exportHashSet = uiBuilder.UILabelStrings2;  // 使用全局的,精确的
        //}
        //else
        //    exportHashSet = uiBuilder.UILabelStrings;  // 在原来的基础上

        //int srcFileRowCount = uiBuilder.UIStringsFile.GetHeight();
        //uiBuilder.UIStringsFile = new KTabFile();
        //uiBuilder.UIStringsFile.NewColumn("_String_");
        //uiBuilder.UIStringsFile.NewColumn("_Sources_");

        ////int rowCount = 1;
        //foreach (var kv in exportHashSet.Items)
        //{
        //    var rowCount = uiBuilder.UIStringsFile.NewRow();
        //    uiBuilder.UIStringsFile.SetValue<string>(rowCount, "_String_", kv.Key);
        //    uiBuilder.UIStringsFile.SetValue<string>(rowCount, "_Sources_", string.Join("|", kv.Value.ToArray()));
        //}
        //uiBuilder.UIStringsFile.Save(UILabelStringsFile);
    }
Esempio n. 10
0
    private static void _FindLabelLocalization(KBuild_NGUI uiBuilder)
    {
        // 收集UiLabel的字符串
        //if (uiBuilder.WindowObject.GetComponent<UIPanel>() == null)
        {
            // 读取UIPanel的depth, 遍历所有UI控件,将其depth加上UIPanel Depth, 以此设置层级关系
            // 如PanelRoot Depth填10,  子控件填0,1,2   打包后,子控件层级为 10 << 5 | 1 = 320, 321, 322
            //foreach (UIWidget uiWidget in uiBuilder.WindowObject.GetComponentsInChildren<UIWidget>(true))
            //{
            //uiWidget.depth = (uiBuilder.PanelRoot.depth + 15) << 5 | (uiWidget.depth + 15);  // + 15是为了杜绝负数!不要填-15以上的
            //}

            // UILabel 多语言
            //foreach (UILabel uiLabel in uiBuilder.WindowObject.GetComponentsInChildren<UILabel>(true))
            //{
            //    //uiLabel.depth = (uiBuilder.PanelRoot.depth + 15) << 5 | (uiLabel.depth + 15);

            //    // 收集字符串
            //    var match = TemplateRegex.Match(uiLabel.text);
            //    if (match.Groups.Count > 1)  // 捕获组1, 中括号内
            //    {
            //        var val = match.Groups[1].Value.Trim();
            //        if (!string.IsNullOrEmpty(val))
            //        {
            //            uiBuilder.UILabelStrings.Add(val, uiBuilder.UIName);
            //            uiBuilder.UILabelStrings2.Add(val, uiBuilder.UIName);
            //        }
            //    }
            //    //if (!uiLabel.text.StartsWith("_"))

            //}
        }
    }
Esempio n. 11
0
 public static void ExportAllUI()
 {
     var buildUI = new KBuild_NGUI();
     buildUI.IsBuildAll = true;
     KResourceBuilder.ProductExport(buildUI);
 }
Esempio n. 12
0
    public static void ExportUIMenu()
    {
        if (ExportUIMenuEvent != null)
            ExportUIMenuEvent();

        KBuild_NGUI uiBuild = new KBuild_NGUI();
        uiBuild.IsBuildAll = false;
        if (!uiBuild.CheckUI(true))
            return;

        uiBuild.BeforeExport();
        uiBuild.ExportCurrentUI();
        uiBuild.AfterExport();
    }
Esempio n. 13
0
 public static void CreateUI()
 {
     KBuild_NGUI.CreateNewUI();
 }