Merge branch 'china/dev-c' of http://60.1.1.230/gaoxin/JL_Client into china/dev-c
commit
5ac8072007
|
|
@ -83,16 +83,7 @@ public class AutoPack : EditorWindow
|
|||
buildWin.titleContent = new GUIContent("打包工具");
|
||||
buildWin.Show();
|
||||
}
|
||||
// 打开文本
|
||||
private void OpenText(string tPath)
|
||||
{
|
||||
if (!File.Exists(tPath))
|
||||
{
|
||||
EditorUtility.DisplayDialog("提示", "文件不存在", "确定");
|
||||
return;
|
||||
}
|
||||
System.Diagnostics.Process.Start("notepad.exe", tPath); //用记事本
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
|
@ -101,6 +92,11 @@ public class AutoPack : EditorWindow
|
|||
|
||||
//EditorGUILayout.LabelField("");
|
||||
MomPackPath = EditorGUILayout.TextField("母包工程地址:", MomPackPath);
|
||||
if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
MomPackPath = EditorUtility.OpenFolderPanel("Resource path", MomPackPath, MomPackPath);
|
||||
EditorPrefs.SetString("MomPackPath", MomPackPath);
|
||||
}
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("请选择要打的包:");
|
||||
|
|
@ -112,17 +108,17 @@ public class AutoPack : EditorWindow
|
|||
if (GUILayout.Button("编辑Config", GUILayout.Height(20f)))
|
||||
{
|
||||
string tpath = _MomPackPath + PackConfig[i][2] + "/Config/" + ConfigFileName;
|
||||
OpenText(tpath);
|
||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
if (GUILayout.Button("编辑Version", GUILayout.Height(20f)))
|
||||
{
|
||||
string tpath = _MomPackPath + PackConfig[i][2] + "/Config/" + VersionFileName;
|
||||
OpenText(tpath);
|
||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
if (GUILayout.Button("编辑Gradle", GUILayout.Height(20f)))
|
||||
{
|
||||
string tpath = _MomPackPath + PackConfig[i][2] + "/build.gradle";
|
||||
OpenText(tpath);
|
||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.EndVertical();
|
||||
|
|
@ -172,8 +168,6 @@ public class AutoPack : EditorWindow
|
|||
EditorUtility.DisplayDialog("提示", "包路径错误", "确定");
|
||||
return;
|
||||
}
|
||||
// 保存配置
|
||||
EditorPrefs.SetString("MomPackPath", MomPackPath);
|
||||
// 开始导出
|
||||
for (int i = 0; i < Chooser.Length; i++)
|
||||
{
|
||||
|
|
@ -326,46 +320,10 @@ public class AutoPack : EditorWindow
|
|||
// 开始生成apk
|
||||
private static void StartGradleBuild(int index)
|
||||
{
|
||||
ProcessCommand(_MomPackPath + PackConfig[index][2], new string[] { "gradlew assembleDebug" });
|
||||
GameEditor.Util.ProcessUtil.ProcessCommand(_MomPackPath + PackConfig[index][2], "gradlew assembleDebug");
|
||||
Debug.Log(PackConfig[index][0] + ":打包完成");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
private static void ProcessCommand(string dir, string[] coms)
|
||||
{
|
||||
System.Diagnostics.Process p = new System.Diagnostics.Process();
|
||||
//设置要启动的应用程序
|
||||
p.StartInfo.FileName = "cmd.exe";
|
||||
//是否使用操作系统shell启动
|
||||
p.StartInfo.UseShellExecute = true;
|
||||
//接受来自调用程序的输入信息
|
||||
p.StartInfo.RedirectStandardInput = false;
|
||||
//输出信息
|
||||
p.StartInfo.RedirectStandardOutput = false;
|
||||
//输出错误
|
||||
p.StartInfo.RedirectStandardError = false;
|
||||
//不显示程序窗口
|
||||
p.StartInfo.CreateNoWindow = false;
|
||||
// 设置文件夹
|
||||
p.StartInfo.WorkingDirectory = dir;
|
||||
// 执行命令
|
||||
for(int i = 0; i < coms.Length; i++)
|
||||
{
|
||||
p.StartInfo.Arguments = "/k " + coms[i] + "&exit";
|
||||
//启动程序
|
||||
p.Start();
|
||||
|
||||
}
|
||||
p.StartInfo.Arguments = "/k exit";
|
||||
//启动程序
|
||||
p.Start();
|
||||
//等待程序执行完退出进程
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
}
|
||||
|
||||
|
||||
//private static void ExportXcode(string _sceneName)
|
||||
//{
|
||||
// PlayerSettings.productName = "太初行";
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -8975,7 +8975,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 92.7, y: -1}
|
||||
m_AnchoredPosition: {x: 200, y: -1}
|
||||
m_SizeDelta: {x: 85, y: 85}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4295345761131377981
|
||||
|
|
|
|||
|
|
@ -430,6 +430,10 @@ function TimeLimitUpHero:OnClose()
|
|||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
end
|
||||
|
||||
if UIManager.IsOpen(UIName.GeneralPopup) then
|
||||
UIManager.ClosePanel(UIName.GeneralPopup)
|
||||
end
|
||||
end
|
||||
--界面销毁时调用(用于子类重写)
|
||||
function TimeLimitUpHero:OnDestroy()
|
||||
|
|
|
|||
|
|
@ -364,6 +364,7 @@ end
|
|||
function this:OnDestroy()
|
||||
this.ratePreList = {}
|
||||
this.listUpPre = {}
|
||||
hero=nil
|
||||
end
|
||||
|
||||
return this
|
||||
|
|
@ -254,7 +254,7 @@ function this.SwitchView(index)
|
|||
RankingManager.InitData(RANK_TYPE.GUILD_CAR_DELEAY_SINGLE,function()
|
||||
local ranks,myRank = RankingManager.GetRankingInfo()
|
||||
this.SetRankDataShow(ranks,myRank,true)
|
||||
this.myGuildName.text = PlayerManager.nickName
|
||||
this.myGuildName.text = PracticeManager.SetNameColor(PlayerManager.nickName,PracticeManager.PracticeLevel)
|
||||
end,nil,1)
|
||||
elseif curIndex == 1 then
|
||||
-- NetManager.RequestRankInfo(RANK_TYPE.GUILD_CAR_DELEAY_GUILD, function(msg)
|
||||
|
|
|
|||
|
|
@ -5244,7 +5244,6 @@ function NetManager.ChoiceDrawCardRequest(actID,_type,func)
|
|||
local data=ActivityProto_pb.choiceDrawCardRequest()
|
||||
data.activityId=actID
|
||||
data.type=_type
|
||||
LogError("actid=="..actID.." type==".._type)
|
||||
local msg = data:SerializeToString()
|
||||
Network:SendMessageWithCallBack(MessageTypeProto_pb.choiceDrawCardRequest, MessageTypeProto_pb.choiceDrawCardResponse, msg, function(buffer)
|
||||
local data = buffer:DataByte()
|
||||
|
|
|
|||
|
|
@ -152,6 +152,9 @@ function NiuQiChongTianPanel:SetTime()
|
|||
end
|
||||
local updateTime = function()
|
||||
self.time.text = "剩余时间:"..TimeToFelaxible(tempTime)
|
||||
if tempTime <= 0 then
|
||||
self.parent:ClosePanel()
|
||||
end
|
||||
end
|
||||
updateTime()
|
||||
self.timer = Timer.New(function()
|
||||
|
|
|
|||
|
|
@ -538,14 +538,14 @@ end
|
|||
|
||||
|
||||
-- 向红点绑定物体
|
||||
function this.BindObject(rpType, rpObj)
|
||||
function this.BindObject(rpType, rpObj)
|
||||
if not rpObj then
|
||||
return
|
||||
end
|
||||
BindObjs[rpType] = BindObjs[rpType] or {}
|
||||
table.insert(BindObjs[rpType], rpObj)
|
||||
--Log("红点类型 = "..rpType..", 绑定了新物体,当前绑定的物体数量为 = "..#BindObjs[rpType])
|
||||
-- 根据状态设置红点现隐
|
||||
if not rpObj then
|
||||
return
|
||||
end
|
||||
rpObj:SetActive(this.GetRedPointStatus(rpType) == RedPointStatus.Show)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
|||
function this:InitComponent(gameObject)
|
||||
this.spLoader = SpriteLoader.New()
|
||||
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
|
||||
this.titleText.text="许愿神将"
|
||||
this.cancelBtn=Util.GetGameObject(gameObject,"CancelBtn")
|
||||
this.confirmBtn=Util.GetGameObject(gameObject,"ConfirmBtn")
|
||||
this.FourStarUpTip=Util.GetGameObject(gameObject,"tip"):GetComponent("Text")
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ end
|
|||
|
||||
function this:BindEvent()
|
||||
Util.AddClick(this.backBtn,function()
|
||||
parent:ClosePanel()
|
||||
if parent then
|
||||
parent:ClosePanel()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -91,7 +93,9 @@ function this:OnShow(_parent,...)
|
|||
this.timer = nil
|
||||
end
|
||||
this.timer = Timer.New(function()
|
||||
parent:ClosePanel()
|
||||
if parent then
|
||||
parent:ClosePanel()
|
||||
end
|
||||
end,2):Start()
|
||||
end
|
||||
|
||||
|
|
@ -100,7 +104,9 @@ function this:OnClose()
|
|||
this.timer:Stop()
|
||||
this.timer = nil
|
||||
end
|
||||
parent:ClosePanel()
|
||||
if parent then
|
||||
parent:ClosePanel()
|
||||
end
|
||||
end
|
||||
|
||||
function this:OnDestroy()
|
||||
|
|
|
|||
|
|
@ -387,165 +387,4 @@ namespace GameEditor.FrameTool {
|
|||
}
|
||||
}
|
||||
|
||||
//看热更大小
|
||||
public class HotfixWindow : EditorWindow
|
||||
{
|
||||
static VersionTxt m_VersionTxt; // 热更版本
|
||||
static string fixVersion;
|
||||
static string fPath;
|
||||
static List<ResourceFile> exDataList;
|
||||
static List<ResourceFile> inDataList;
|
||||
static DirectoryInfo pathInfo;
|
||||
static decimal Size = 0;
|
||||
static Dictionary<string, ResourceFile> exDataDic = new Dictionary<string, ResourceFile>();
|
||||
|
||||
[MenuItem("Build/HotfixSize")]
|
||||
static void Init()
|
||||
{
|
||||
fixVersion = Application.dataPath + "/../AssetBundles/version.txt";
|
||||
pathInfo = new DirectoryInfo(Application.dataPath);
|
||||
GetExternalFile(fixVersion);
|
||||
GetInternalData();
|
||||
|
||||
// Get existing open window or if none, make a new one:
|
||||
HotfixWindow window = (HotfixWindow)EditorWindow.GetWindow(typeof(HotfixWindow));
|
||||
window.titleContent = new GUIContent("热更大小");
|
||||
window.Show();
|
||||
}
|
||||
//下载外部.unity3d文件
|
||||
private static void GetExternalFile(string path)
|
||||
{
|
||||
//获取下载文件链接
|
||||
string json = File.ReadAllText(path);
|
||||
m_VersionTxt = JsonUtility.FromJson<VersionTxt>(json);
|
||||
string url = m_VersionTxt.resUrl + "Android/files.unity3d";
|
||||
//获取文件存放路径
|
||||
fPath = pathInfo.Parent.FullName + @"\Temp";
|
||||
if (File.Exists(fPath + @"\files.unity3d"))
|
||||
{
|
||||
File.Delete(fPath + @"\files.unity3d");
|
||||
}
|
||||
// 设置参数
|
||||
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
|
||||
//发送请求并获取相应回应数据
|
||||
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
|
||||
//直到request.GetResponse()程序才开始向目标网页发送Post请求
|
||||
Stream responseStream = response.GetResponseStream();
|
||||
//创建本地文件写入流
|
||||
Stream stream = new FileStream(fPath + @"\files.unity3d", FileMode.Create, FileAccess.Write);
|
||||
byte[] bArr = new byte[1024];
|
||||
int size = responseStream.Read(bArr, 0, (int)bArr.Length);
|
||||
while (size > 0)
|
||||
{
|
||||
stream.Write(bArr, 0, size);
|
||||
size = responseStream.Read(bArr, 0, (int)bArr.Length);
|
||||
}
|
||||
stream.Close();
|
||||
responseStream.Close();
|
||||
}
|
||||
|
||||
//重新下载外部.unity3d文件
|
||||
private static void RegetExternalFile()
|
||||
{
|
||||
//获取下载文件链接
|
||||
string url = m_VersionTxt.resUrl + "Android/files.unity3d";
|
||||
//获取文件存放路径
|
||||
fPath = pathInfo.Parent.FullName + @"\Temp";
|
||||
if (File.Exists(fPath + @"\files.unity3d"))
|
||||
{
|
||||
File.Delete(fPath + @"\files.unity3d");
|
||||
}
|
||||
// 设置参数
|
||||
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
|
||||
//发送请求并获取相应回应数据
|
||||
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
|
||||
//直到request.GetResponse()程序才开始向目标网页发送Post请求
|
||||
Stream responseStream = response.GetResponseStream();
|
||||
//创建本地文件写入流
|
||||
Stream stream = new FileStream(fPath + @"\files.unity3d", FileMode.Create, FileAccess.Write);
|
||||
byte[] bArr = new byte[1024];
|
||||
int size = responseStream.Read(bArr, 0, (int)bArr.Length);
|
||||
while (size > 0)
|
||||
{
|
||||
stream.Write(bArr, 0, size);
|
||||
size = responseStream.Read(bArr, 0, (int)bArr.Length);
|
||||
}
|
||||
stream.Close();
|
||||
responseStream.Close();
|
||||
}
|
||||
|
||||
//遍历外部unity3d数据
|
||||
private static void GetExternalData()
|
||||
{
|
||||
UnityEngine.AssetBundle bundle = UnityEngine.AssetBundle.LoadFromFile(fPath + "\\" + UpdateConfigs.FILES);
|
||||
ResourceFiles files = bundle.LoadAsset<ResourceFiles>("game");
|
||||
exDataList = files.files;
|
||||
bundle.Unload(true);
|
||||
exDataList.Sort(delegate (ResourceFile a, ResourceFile b) { return a.crc.CompareTo(b.crc); });
|
||||
for (int i = 0; i < exDataList.Count; i++)
|
||||
{
|
||||
if (!exDataDic.ContainsKey(exDataList[i].fileName))
|
||||
{
|
||||
exDataDic.Add(exDataList[i].fileName, exDataList[i]);
|
||||
}else
|
||||
{
|
||||
exDataDic[exDataList[i].fileName] = exDataList[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//遍历内部unity3d数据
|
||||
private static void GetInternalData()
|
||||
{
|
||||
UnityEngine.AssetBundle bundle = UnityEngine.AssetBundle.LoadFromFile(pathInfo.Parent.FullName + @"\BuildABs\Android\" + UpdateConfigs.FILES);
|
||||
ResourceFiles files = bundle.LoadAsset<ResourceFiles>("game");
|
||||
inDataList = files.files;
|
||||
bundle.Unload(true);
|
||||
}
|
||||
|
||||
//对比数据
|
||||
private static void CompareData()
|
||||
{
|
||||
for (int i = 0; i < inDataList.Count; i++)
|
||||
{
|
||||
if (!exDataDic.ContainsKey (inDataList[i].fileName))
|
||||
{
|
||||
UnityEngine.Debug.Log("NewFile: "+inDataList[i].fileName);
|
||||
Size = inDataList[i].size + Size;
|
||||
}else
|
||||
{
|
||||
if(!inDataList[i].crc.Equals(exDataDic[inDataList[i].fileName].crc))
|
||||
{
|
||||
UnityEngine.Debug.Log("ModifiedFile: " + inDataList[i].fileName);
|
||||
Size = inDataList[i].size + Size;
|
||||
}
|
||||
}
|
||||
}
|
||||
Size = Size / 1048576;
|
||||
UnityEngine.Debug.Log(Size + "M");
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("线上位置:");
|
||||
m_VersionTxt.resUrl = EditorGUILayout.TextField(m_VersionTxt.resUrl);
|
||||
EditorGUILayout.EndVertical();
|
||||
if (GUILayout.Button("重新获取files", GUILayout.Height(40f)))
|
||||
{
|
||||
UnityEngine.Debug.Log("URL:"+ m_VersionTxt.resUrl);
|
||||
RegetExternalFile();
|
||||
}
|
||||
if (GUILayout.Button("对比大小", GUILayout.Height(40f)))
|
||||
{
|
||||
Size = 0;
|
||||
GetExternalData();
|
||||
CompareData();
|
||||
}
|
||||
|
||||
string resUrl = Size.ToString("0.00") + "M";
|
||||
resUrl = EditorGUILayout.TextField(resUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,379 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using GameEditor.Core;
|
||||
using GameEditor.GameEditor.PlayerBuilder;
|
||||
using GameEditor.Util;
|
||||
using GameLogic;
|
||||
using System.Diagnostics;
|
||||
using ResUpdate;
|
||||
using System.Threading;
|
||||
using System.Net;
|
||||
|
||||
namespace GameEditor.FrameTool {
|
||||
public static class HotFixTool
|
||||
{
|
||||
//重新下载外部.unity3d文件
|
||||
public static void RegetExternalFile(string resUrl, string outPath)
|
||||
{
|
||||
//获取下载文件链接
|
||||
string url = resUrl + "/files.unity3d";
|
||||
string dlPath = outPath + "/files.unity3d";
|
||||
// 文件夹没有就创建
|
||||
if (!Directory.Exists(outPath))
|
||||
{
|
||||
Directory.CreateDirectory(outPath);
|
||||
}
|
||||
//获取文件存放路径
|
||||
if (File.Exists(dlPath))
|
||||
{
|
||||
File.Delete(dlPath);
|
||||
}
|
||||
// 设置参数
|
||||
UnityEngine.Debug.Log(url);
|
||||
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
|
||||
//发送请求并获取相应回应数据
|
||||
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
|
||||
//直到request.GetResponse()程序才开始向目标网页发送Post请求
|
||||
Stream responseStream = response.GetResponseStream();
|
||||
//创建本地文件写入流
|
||||
Stream stream = new FileStream(dlPath, FileMode.Create, FileAccess.Write);
|
||||
byte[] bArr = new byte[1024];
|
||||
int size = responseStream.Read(bArr, 0, (int)bArr.Length);
|
||||
while (size > 0)
|
||||
{
|
||||
stream.Write(bArr, 0, size);
|
||||
size = responseStream.Read(bArr, 0, (int)bArr.Length);
|
||||
}
|
||||
stream.Close();
|
||||
responseStream.Close();
|
||||
}
|
||||
|
||||
//遍历内部unity3d数据
|
||||
public static List<ResourceFile> GetFilesList(string filesPath)
|
||||
{
|
||||
UnityEngine.AssetBundle bundle = UnityEngine.AssetBundle.LoadFromFile(filesPath + UpdateConfigs.FILES);
|
||||
ResourceFiles files = bundle.LoadAsset<ResourceFiles>("game");
|
||||
bundle.Unload(true);
|
||||
return files.files;
|
||||
}
|
||||
|
||||
// 获取差异文件list
|
||||
public static List<ResourceFile> GetDiffList(List<ResourceFile> inDataList, List<ResourceFile> exDataList)
|
||||
{
|
||||
List<ResourceFile> diffList = new List<ResourceFile>();
|
||||
Dictionary<string, ResourceFile> exDataDic = new Dictionary<string, ResourceFile>();
|
||||
for (int i = 0; i < exDataList.Count; i++)
|
||||
{
|
||||
if (!exDataDic.ContainsKey(exDataList[i].fileName))
|
||||
{
|
||||
exDataDic.Add(exDataList[i].fileName, exDataList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
exDataDic[exDataList[i].fileName] = exDataList[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < inDataList.Count; i++)
|
||||
{
|
||||
if (!exDataDic.ContainsKey(inDataList[i].fileName))
|
||||
{
|
||||
diffList.Add(inDataList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!inDataList[i].crc.Equals(exDataDic[inDataList[i].fileName].crc))
|
||||
{
|
||||
diffList.Add(inDataList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return diffList;
|
||||
}
|
||||
|
||||
// 计算大小
|
||||
public static decimal GetDiffSize(List<ResourceFile> diffList)
|
||||
{
|
||||
decimal size = 0;
|
||||
foreach(ResourceFile rf in diffList)
|
||||
{
|
||||
size += rf.size;
|
||||
}
|
||||
return size / 1048576;
|
||||
}
|
||||
}
|
||||
|
||||
class HotFixConfig
|
||||
{
|
||||
public string desc;
|
||||
public string dir_name;
|
||||
public bool isCalSize = false;
|
||||
public bool isChoose = false;
|
||||
|
||||
public List<HotFixSetting> hotFixSettings;
|
||||
|
||||
public decimal project_local_size = 0;
|
||||
public List<ResourceFile> project_local_list;
|
||||
|
||||
public HotFixConfig(string _dir_name)
|
||||
{
|
||||
desc = _dir_name;
|
||||
dir_name = _dir_name;
|
||||
|
||||
hotFixSettings = new List<HotFixSetting>();
|
||||
|
||||
//
|
||||
isCalSize = false;
|
||||
}
|
||||
|
||||
// 添加配置文件夹
|
||||
public void AddSetting(string _desc, string _dir_name, string _dir_cdn_setting)
|
||||
{
|
||||
hotFixSettings.Add(new HotFixSetting(_desc, _dir_name, _dir_cdn_setting));
|
||||
}
|
||||
|
||||
// 计算本地到工程的大小
|
||||
public void CalHotFixSize()
|
||||
{
|
||||
if (HotfixWindow._HotFixProjectPath.Equals(""))
|
||||
{
|
||||
UnityEngine.Debug.LogError("热更工程路径为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 工程中的位置
|
||||
string project_files_path = Application.dataPath + "/../BuildABs/" + HotfixWindow.Platform + "/";
|
||||
// GIT位置
|
||||
string local_files_path = HotfixWindow._HotFixProjectPath + "/Root/" + dir_name + "/" + HotfixWindow.Platform + "/";
|
||||
|
||||
// 计算差异文件
|
||||
project_local_list = HotFixTool.GetDiffList(HotFixTool.GetFilesList(project_files_path), HotFixTool.GetFilesList(local_files_path));
|
||||
|
||||
// 计算大小
|
||||
project_local_size = HotFixTool.GetDiffSize(project_local_list);
|
||||
|
||||
//
|
||||
isCalSize = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class HotFixSetting
|
||||
{
|
||||
public string desc; // 设置描述
|
||||
public string dir_name; // 热更分支文件夹
|
||||
public string dir_cdn_setting; // cdn设置文件夹
|
||||
public string path_cdn_setting;// cdn设置文件夹全路径
|
||||
|
||||
public bool isCalSize = false; // 判断是否计算过大小了
|
||||
public bool isChoose = false; // 是否被选中
|
||||
|
||||
public decimal local_cdn_size = 0; // git与cdn比较 热更文件的文件大小
|
||||
public decimal project_cdn_size = 0; // 工程与cdn比较 热更文件的文件大小
|
||||
|
||||
public List<ResourceFile> local_cdn_list; // git与cdn比较 热更文件列表
|
||||
public List<ResourceFile> project_cdn_list; // 工程与cdn比较 热更文件列表
|
||||
|
||||
public VersionTxt local_version;
|
||||
|
||||
public HotFixSetting(string _desc, string _dir_name, string _dir_cdn_setting)
|
||||
{
|
||||
desc = _desc;
|
||||
dir_name = _dir_name;
|
||||
dir_cdn_setting = _dir_cdn_setting;
|
||||
path_cdn_setting = HotfixWindow._HotFixProjectPath + "/Root/" + dir_name + "/" + dir_cdn_setting + "/";
|
||||
isCalSize = false;
|
||||
}
|
||||
|
||||
public void CalHotFixSize()
|
||||
{
|
||||
if(HotfixWindow._HotFixProjectPath.Equals("")){
|
||||
UnityEngine.Debug.LogError("热更工程路径为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
// cdn上files文件保存的位置
|
||||
string cdn_files_path = path_cdn_setting + "__Download/";
|
||||
// 工程中的位置
|
||||
string project_files_path = Application.dataPath + "/../BuildABs/" + HotfixWindow.Platform + "/";
|
||||
// GIT位置
|
||||
string local_files_path = HotfixWindow._HotFixProjectPath + "/Root/" + dir_name + "/" + HotfixWindow.Platform + "/";
|
||||
|
||||
// 读取version文件
|
||||
string json = File.ReadAllText(path_cdn_setting + AppConst.GameVersionFile);
|
||||
local_version = JsonUtility.FromJson<VersionTxt>(json);
|
||||
|
||||
// 下载cdn上的files文件
|
||||
HotFixTool.RegetExternalFile(local_version.resUrl + HotfixWindow.Platform, cdn_files_path);
|
||||
|
||||
// 计算差异文件
|
||||
local_cdn_list = HotFixTool.GetDiffList(HotFixTool.GetFilesList(local_files_path), HotFixTool.GetFilesList(cdn_files_path));
|
||||
project_cdn_list = HotFixTool.GetDiffList(HotFixTool.GetFilesList(project_files_path), HotFixTool.GetFilesList(cdn_files_path));
|
||||
|
||||
// 计算大小
|
||||
local_cdn_size = HotFixTool.GetDiffSize(local_cdn_list);
|
||||
project_cdn_size = HotFixTool.GetDiffSize(project_cdn_list);
|
||||
|
||||
//
|
||||
isCalSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
//看热更大小
|
||||
public class HotfixWindow : EditorWindow
|
||||
{
|
||||
|
||||
static string[][] _SettingConfig = new string[][]{
|
||||
new string[]{ "C轮测试v2", "mht_china/local", "cdn_v2", "china/dev-c" },
|
||||
new string[]{ "C轮测试v3", "mht_china/local", "cdn_v3", "china/dev-c" }
|
||||
};
|
||||
|
||||
static Dictionary<string, HotFixConfig> _HotFixConfigDic = new Dictionary<string, HotFixConfig>();
|
||||
static string benchName = "";
|
||||
public static string _HotFixProjectPath;
|
||||
|
||||
#if UNITY_ANDROID
|
||||
public static string Platform = "Android";
|
||||
#elif UNITY_IOS
|
||||
public static string Platform = "IOS";
|
||||
#else
|
||||
public static string Platform = "Android";
|
||||
#endif
|
||||
|
||||
[MenuItem("Build/Hotfix")]
|
||||
static void Init()
|
||||
{
|
||||
|
||||
benchName = GitUtil.GetCurBenchName();
|
||||
UnityEngine.Debug.Log("当前分支:" + benchName);
|
||||
_HotFixProjectPath = EditorPrefs.GetString("_HotFixProjectPath", "");
|
||||
|
||||
InitData();
|
||||
InitStyle();
|
||||
// Get existing open window or if none, make a new one:
|
||||
HotfixWindow window = (HotfixWindow)EditorWindow.GetWindow(typeof(HotfixWindow));
|
||||
window.titleContent = new GUIContent("热更大小");
|
||||
window.Show();
|
||||
}
|
||||
|
||||
static void InitData()
|
||||
{
|
||||
_HotFixConfigDic.Clear();
|
||||
foreach (string[] sc in _SettingConfig)
|
||||
{
|
||||
string desc = sc[0];
|
||||
string folder = sc[1];
|
||||
string setting = sc[2];
|
||||
string bench = sc[3];
|
||||
if (bench.Equals(benchName))
|
||||
{
|
||||
HotFixConfig hfc;
|
||||
_HotFixConfigDic.TryGetValue(folder, out hfc);
|
||||
if (hfc == null)
|
||||
{
|
||||
hfc = new HotFixConfig(folder);
|
||||
_HotFixConfigDic.Add(folder, hfc);
|
||||
}
|
||||
hfc.AddSetting(desc, folder, setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 自定义style
|
||||
static GUIStyle FStyle = new GUIStyle();
|
||||
static GUIStyle SStyle = new GUIStyle();
|
||||
static void InitStyle()
|
||||
{
|
||||
FStyle.fontSize = 30;
|
||||
FStyle.fontStyle = FontStyle.Bold;
|
||||
|
||||
SStyle.fontSize = 25;
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("当前工程GIT分支:"+ benchName);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
_HotFixProjectPath = EditorGUILayout.TextField("热更GIT工程地址:", _HotFixProjectPath);
|
||||
if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
_HotFixProjectPath = EditorUtility.OpenFolderPanel("Resource path", _HotFixProjectPath, _HotFixProjectPath);
|
||||
EditorPrefs.SetString("_HotFixProjectPath", _HotFixProjectPath);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.LabelField("请选择要更新的CDN:");
|
||||
foreach(string k in _HotFixConfigDic.Keys)// i = 0; i < _CurConfig.Length; i++)
|
||||
{
|
||||
HotFixConfig _CurConfig = _HotFixConfigDic[k];
|
||||
|
||||
_CurConfig.isChoose = EditorGUILayout.ToggleLeft("<color=yellow>"+_CurConfig.desc+"</color>", _CurConfig.isChoose, FStyle, GUILayout.Height(40));
|
||||
if (_CurConfig.isChoose)
|
||||
{
|
||||
EditorGUILayout.LabelField("工程到Git:"+_CurConfig.project_local_size.ToString("0.00") + "M");
|
||||
if (!_CurConfig.isCalSize)
|
||||
{
|
||||
_CurConfig.CalHotFixSize();
|
||||
}
|
||||
//EditorGUILayout.LabelField("本地到CDN目录:"+_CurConfig[i].local_cdn_size.ToString("0.00") + "M");
|
||||
//EditorGUILayout.LabelField("工程到CDN目录:"+_CurConfig[i].project_cdn_size.ToString("0.00") + "M");
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
//if (GUILayout.Button("编辑Config", GUILayout.Height(20f)))
|
||||
//{
|
||||
//}
|
||||
//if (GUILayout.Button("编辑Version", GUILayout.Height(20f)))
|
||||
//{
|
||||
//}
|
||||
//// 自动计算一遍大小
|
||||
//if (!_CurConfig.isCalSize)
|
||||
//{
|
||||
// _CurConfig.CalHotFixSize();
|
||||
//}
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
|
||||
foreach (HotFixSetting hfs in _CurConfig.hotFixSettings)// i = 0; i < _CurConfig.Length; i++)
|
||||
{
|
||||
hfs.isChoose = EditorGUILayout.ToggleLeft("<color=green>" + hfs.desc + "</color>", hfs.isChoose, SStyle, GUILayout.Height(30));
|
||||
if (hfs.isChoose)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.BeginVertical();
|
||||
EditorGUILayout.LabelField("GIT到CDN:" + hfs.local_cdn_size.ToString("0.00") + "M");
|
||||
EditorGUILayout.LabelField("工程到CDN:" + hfs.project_cdn_size.ToString("0.00") + "M");
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
if (GUILayout.Button("编辑Config", GUILayout.Height(40f), GUILayout.Width(100f)))
|
||||
{
|
||||
string tpath = hfs.path_cdn_setting + AppConst.GameConfigFile;
|
||||
ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
if (GUILayout.Button("编辑Version", GUILayout.Height(40f), GUILayout.Width(100f)))
|
||||
{
|
||||
string tpath = hfs.path_cdn_setting + AppConst.GameVersionFile;
|
||||
ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
// 自动计算一遍大小
|
||||
if (!hfs.isCalSize)
|
||||
{
|
||||
hfs.CalHotFixSize();
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5164c07ced461e24b97bbc6915699306
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
|
||||
namespace GameEditor.Util
|
||||
{
|
||||
|
||||
public static class GitUtil
|
||||
{
|
||||
|
||||
//
|
||||
public static string GetCurBenchName()
|
||||
{
|
||||
string dir = Application.dataPath.Replace("/Assets", "");
|
||||
string fileName = dir + "/BenchName.txt";
|
||||
ProcessUtil.ProcessCommand(dir, "git symbolic-ref --short -q HEAD>" + fileName);
|
||||
string[] flines = File.ReadAllLines(fileName, System.Text.Encoding.UTF8);
|
||||
string benchName = flines[0].Trim();
|
||||
File.Delete(fileName);
|
||||
return benchName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ad6526cc60cf9aa4aadd76c6c393a1a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
|
||||
namespace GameEditor.Util
|
||||
{
|
||||
|
||||
public static class ProcessUtil
|
||||
{
|
||||
|
||||
//
|
||||
public static void ProcessCommand(string dir, string com, bool isShowWindow = false)
|
||||
{
|
||||
ProcessCommand(dir, new string[] { com }, isShowWindow);
|
||||
}
|
||||
public static void ProcessCommand(string dir, string[] coms, bool isShowWindow = false)
|
||||
{
|
||||
System.Diagnostics.Process p = new System.Diagnostics.Process();
|
||||
//设置要启动的应用程序
|
||||
p.StartInfo.FileName = "cmd.exe";
|
||||
//是否使用操作系统shell启动
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
//接受来自调用程序的输入信息
|
||||
p.StartInfo.RedirectStandardInput = false;
|
||||
//输出信息
|
||||
p.StartInfo.RedirectStandardOutput = false;
|
||||
//输出错误
|
||||
p.StartInfo.RedirectStandardError = false;
|
||||
//不显示程序窗口
|
||||
p.StartInfo.CreateNoWindow = !isShowWindow;
|
||||
// 设置文件夹
|
||||
p.StartInfo.WorkingDirectory = dir;
|
||||
// 执行命令
|
||||
for (int i = 0; i < coms.Length; i++)
|
||||
{
|
||||
p.StartInfo.Arguments = "/k " + coms[i] + "&exit";
|
||||
//启动程序
|
||||
p.Start();
|
||||
//等待程序执行完退出进程
|
||||
p.WaitForExit();
|
||||
|
||||
}
|
||||
//p.StartInfo.Arguments = "/k exit";
|
||||
////启动程序
|
||||
//p.Start();
|
||||
//等待程序执行完退出进程
|
||||
//p.WaitForExit();
|
||||
p.Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 打开文本
|
||||
public static void OpenText(string tPath)
|
||||
{
|
||||
if (!File.Exists(tPath))
|
||||
{
|
||||
EditorUtility.DisplayDialog("提示", "文件不存在", "确定");
|
||||
return;
|
||||
}
|
||||
System.Diagnostics.Process.Start("notepad.exe", tPath); //用记事本
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 353de534df0f29d429247ead69f82192
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue