Ejemplo n.º 1
0
 /// <summary>
 /// 打包机专用,相当于调用 Tools♥/[打包ANDROID]
 /// </summary>
 //[MenuItem("Tools♥/码农专用/[打包机 GenData4Android简体]", false)]
 public static void Pack4AndroidSlient()
 {
     using (ProgressBarAutoHide.Get(0))
         using (HSUtils.ExeTimer("菜单: [打包机 GenData4Android简体]"))
             using (RunTimeConfiger.EnterRobotMode)
                 Pack4Current();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 生成Assets/StreamingAssets/目录下的[value,filter,lua]
        /// 清理无用AB包 →→→ XLS →→→ 加密压缩的 Value/filter/lua →→→ BuildCurrent
        /// </summary>
        public static void GenPackDataAllTheWay(string title, bool force, bool buildab, bool xls2XMLExe)
        {
            using (HSUtils.ExeTimer("GenDataAllTheWay [{0}]".f(HSCTC.DisplayActiveLanguage)))
            {
                BeanDictMenu.GenBeanDictAllTheWay(title, force, xls2XMLExe); //【Assets/StreamingAssets/value】

                using (HSUtils.ExeTimer("ZipEncFilter"))
                {
                    MenuHelper.SafeDisplayProgressBar(title, "FinalPackHelper.ZipAndEncryptFilter", 0.6f);
                    GenDataHelper.ZipAndEncryptFilter();  //【Assets/StreamingAssets/filter】
                }

                using (HSUtils.ExeTimer("PackZipEncLua"))
                {
                    MenuHelper.SafeDisplayProgressBar(title, "FinalPackHelper.PackZipAndEncryptLua", 0.7f);
                    LuaMenu.PackZipAndEncryptLua(true); //【Assets/StreamingAssets/lua】
                }

                if (HSCTC.ConfigPath.Sub("skip_copy_language_assets").ExistsAsFile())
                {
                    HSUtils.LogWarning("当前配置禁用语言相关资源的复制。");
                }
                else
                {
                    using (HSUtils.ExeTimer("Sync Language Resources"))
                    {
                        foreach (var kv in GPDC.LanguageResourceMap)
                        {
                            var src = HSCTC.ActiveLanguageDir.StandardSub(kv.Key);
                            var dst = kv.Value;
                            if (src.ExistsAsFolder())
                            {
                                HSUtils.Log("Copying [{0}] to [{1}] ...", src, dst);
                                Mini.DirectoryCopy(src, dst, true, true);
                            }
                        }
                    }
                }

                using (HSUtils.ExeTimer("AssetDatabase.Refresh"))
                {
                    MenuHelper.SafeDisplayProgressBar(title, "AssetDatabase.Refresh", 0.8f);
                    AssetDatabase.Refresh();
                }

                if (buildab)
                {
                    using (HSUtils.ExeTimer("AssetTool.BuildCurrent"))
                    {
                        MenuHelper.SafeDisplayProgressBar(title, "AssetTool.BuildCurrent", 0.9f);
                        AssetTool.BuildCurrent();
                        Debug.LogWarning("▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲ [ 成功完成BuildCurrent ] ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲".EatWithTID());
                    }
                }
                else if (ResourceLoader.LoadFromABAlways)
                {
                    HSUtils.LogWarning("当前设置永远从AB包加载。如果不打AB包,程序运行可能会异常。");
                }
            }
        }
Ejemplo n.º 3
0
        public List <TriggerInstance> GenerateDifferentTriggers(List <ItemDropTip> tipPools, int count, float percentile, string tag = "")
        {
            List <ItemDropTip>     visited = new List <ItemDropTip>();
            List <TriggerInstance> rst     = new List <TriggerInstance>();

            if (tipPools.Count < count)
            {
                HSUtils.LogError("物品随机属性个数小于设定个数!模板=" + Key);
                count = tipPools.Count;
            }
            var tList = ToolsShared.GenerateRandomListNotRepeat(tipPools, count);

            for (var i = 0; i < tList.Count; i++)
            {
                var             t       = tList[i];
                TriggerInstance trigger = t.GenerateItemTrigger(percentile);
                if (trigger != null)
                {
                    trigger.Tag = tag;
                    rst.Add(trigger);
                }
            }

            return(rst);
        }
Ejemplo n.º 4
0
 public static void RepackLua(bool updateOnly)
 {
     using (HSUtils.ExeTimer("RepackLua"))
     {
         PackZipAndEncryptLua(updateOnly);
         AssetDatabase.Refresh();
         if (GameRunning())
         {
             LuaManager.Init(true);
             //TriggerManager.Init();
         }
     }
 }
Ejemplo n.º 5
0
        public static void ClearAllCache()
        {
            HSUtils.LogWarning("清理和XML、filter、lua、ABMd5相关的所有中间文件和目标文件。");

            HSCTC.ClearAllCacheAndDstFiles();

            Mini.ClearDirectory(GPDC.CachePath);

            GPDC.LuaBytes.Delete();
            GPDC.LastLuaSummaryFile.Delete();

            GPDC.FilterTSFile.Delete();
            GPDC.CEFilterTSFile.Delete();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 看是否有lua文件更新,如果有,则重新打包Lua
 /// </summary>
 public static void UpdateLuaInDesignMode(string title)
 {
     using (HSUtils.ExeTimer("UpdateLuaInDesignMode"))
     {
         DateTime now = DateTime.Now;
         if (new DirectoryInfo("data/lua").GetFiles("*.lua", SearchOption.AllDirectories)
             .Where(fi => fi.LastWriteTime > _lastReloadTime)
             .Any())
         {
             MenuHelper.SafeDisplayProgressBar(title, "重新载入LUA", 0.8f);
             RepackLua(true);
             _lastReloadTime = now;
         }
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 压缩加密filter.txt,自动判断是否更新。只要filter日期变化,就会重新打包。
 /// </summary>
 public static void ZipAndEncryptFilter()
 {
     if (GPDC.FilterFile.Exists() && HSUnityEnv.CEFilterPath.Exists() &&
         GPDC.FilterTSFile.Exists() && GPDC.CEFilterTSFile.Exists() &&
         GPDC.FilterFile.LastWriteTime() == GPDC.FilterTSFile.LastWriteTime() &&
         HSUnityEnv.CEFilterPath.LastWriteTime() == GPDC.CEFilterTSFile.LastWriteTime())
     {
         HSUtils.Log("[{0}] 没有更新,因此不用重新生成 [{1}]。".Eat(GPDC.FilterFile.ShortName(), HSUnityEnv.CEFilterPath.ShortName()));
     }
     else
     {
         HSUtils.Log("[{0}]有更新,因此重新生成 [{1}]。".Eat(GPDC.FilterFile.ShortName(), HSUnityEnv.CEFilterPath.ShortName()));
         BinaryResourceLoader.SaveCEBinary(GPDC.FilterFile, HSUnityEnv.CEFilterPath);
         GPDC.FilterFile.Touch(GPDC.FilterTSFile);
         HSUnityEnv.CEFilterPath.Touch(GPDC.CEFilterTSFile);
     }
 }
Ejemplo n.º 8
0
 static void PackAllDataInner(bool isBuildForIOS, string title, bool force, string language)
 {
     using (HSUtils.ExeTimer("PackAllDataInner {0}".f(title)))
     {
         var bk = HSCTC.ActiveLanguage;
         HSCTC.ActiveLanguage = language;
         try
         {
             GenDataMenuCmd.GenPackDataAllTheWay(title, force, true, false); //支持启动前和运行中取消
             MoveAndGenMD5(isBuildForIOS, title);
             Debug.LogWarning("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬");
             Debug.LogWarning("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ [{0}] 语言包 [{1}] 全部完成,恭喜。".EatWithTID(title, HSCTC.DisplayActiveLanguage).PadRight(60, '▬'));
             Debug.LogWarning("▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬");
             MenuHelper.SafeShow100Progress(title);
         }
         finally
         {
             HSCTC.ActiveLanguage = bk;
         }
     }
 }
Ejemplo n.º 9
0
        private void setupScenarioModule()
        {
            ProtoScenarioModule protoScenarioModule =
                HighLogic.CurrentGame.scenarios.FirstOrDefault(i => i.moduleName == typeof(HaystackScenarioModule).Name);

            if (protoScenarioModule == null)
            {
                HSUtils.DebugLog("adding scenario module");
                HighLogic.CurrentGame.AddProtoScenarioModule(typeof(HaystackScenarioModule),
                                                             HaystackScenarioModule.Scenes);
            }
            else
            {
                var missing = HaystackScenarioModule.Scenes.Except(protoScenarioModule.targetScenes);
                foreach (var i in missing)
                {
                    HSUtils.DebugLog("missing scenario module scene: {0}", i);
                    protoScenarioModule.targetScenes.Add(i);
                }
            }
        }
Ejemplo n.º 10
0
        public static void UpdateAllInner(string title)
        {
            MenuHelper.SafeDisplayProgressBar(title, "检查新XLS需要转换为XML", 0.1f);

            using (HSUtils.ExeTimer("Xls2XMLHelperWin.SafeRunBlocked"))
                Xls2XMLHelperWin.SafeRunBlocked(false);

            MenuHelper.SafeDisplayProgressBar(title, "加载更新的XML", 0.5f);

            using (ProgressBarAutoHide.Get(0))
            {
                ConfigTable.VisitValues((beanDict) =>
                {
                    XMLBDUpdater.Instance.UpdateChanged(beanDict, CancellationToken.None, (s, p) => MenuHelper.SafeDisplayProgressBar("加载XML", s, p));
                });

                MenuHelper.SafeDisplayProgressBar(title, "查看lua更新情况", 0.7f);
                //LuaMenu.UpdateLuaInDesignMode(title);
            }

            MenuHelper.SafeShow100Progress(title);
        }
 public override void OnLoad(ConfigNode node)
 {
     HSUtils.DebugLog("HaystackScenarioModule#OnLoad: {0}", HighLogic.LoadedScene);
     DataManager.Instance.Load(node);
 }
Ejemplo n.º 12
0
 //[MenuItem("Tools♥/[★★GEN DATA命令行 (重载XLS)]")]
 static void GenerateDataForceExe()
 {
     using (HSUtils.ExeTimer("菜单:[GEN DATA (重载XLS)]"))
         MenuHelper.SafeWrapMenuAction("GENERATE DATA重新转换XLS", title => GenerateDataWithEnding(title, true, true));
 }
Ejemplo n.º 13
0
 //[MenuItem("Tools♥/[★★GEN DATA命令行]")]
 static void GenerateDataExe()
 {
     using (HSUtils.ExeTimer("菜单:[GEN DATA]"))
         MenuHelper.SafeWrapMenuAction("GENERATE DATA", title => GenerateDataWithEnding(title, false, true));
 }