645 lines
22 KiB
C#
645 lines
22 KiB
C#
|
|
// 打指定的 extend包 ----By ChenGY
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using UnityEditor;
|
|||
|
|
using System.IO;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using System.Collections;
|
|||
|
|
using MiniJSON;
|
|||
|
|
using System.Diagnostics;
|
|||
|
|
using taurus.client;
|
|||
|
|
using taurus.unity;
|
|||
|
|
|
|||
|
|
public class pack_data:IComparable
|
|||
|
|
{
|
|||
|
|
string name;
|
|||
|
|
string version;
|
|||
|
|
string game_id;
|
|||
|
|
string type;
|
|||
|
|
string bundle;
|
|||
|
|
public bool is_pack;
|
|||
|
|
public void fillData(string n, string v, string i, string t, string b)
|
|||
|
|
{
|
|||
|
|
name = n;
|
|||
|
|
version = v;
|
|||
|
|
game_id = i;
|
|||
|
|
type = t;
|
|||
|
|
bundle = b;
|
|||
|
|
}
|
|||
|
|
public string getData(string property)
|
|||
|
|
{
|
|||
|
|
switch (property)
|
|||
|
|
{
|
|||
|
|
case ("name"):
|
|||
|
|
return name;
|
|||
|
|
case ("id"):
|
|||
|
|
return game_id;
|
|||
|
|
case ("version"):
|
|||
|
|
return version;
|
|||
|
|
case ("type"):
|
|||
|
|
return type;
|
|||
|
|
case ("bundle"):
|
|||
|
|
return bundle;
|
|||
|
|
default:
|
|||
|
|
return "";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public int CompareTo(object obj) {
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
pack_data info = (pack_data)obj;
|
|||
|
|
return Convert.ToInt16(this.game_id).CompareTo(Convert.ToInt16(info.game_id));
|
|||
|
|
}
|
|||
|
|
catch (Exception ex) { throw new Exception(ex.Message); }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class BuildExtendWindow : EditorWindow
|
|||
|
|
{
|
|||
|
|
static ArrayList gameLit;
|
|||
|
|
static Hashtable packData;
|
|||
|
|
static bool all_selected = false;
|
|||
|
|
static bool obl_all_selected = false;
|
|||
|
|
static bool show_version = false;
|
|||
|
|
static bool show_id = false;
|
|||
|
|
static bool pro = true;
|
|||
|
|
static bool ver_increase = false;
|
|||
|
|
static bool old_pro = pro;
|
|||
|
|
static bool auto_show_lastpack = false;
|
|||
|
|
static bool editable = false;
|
|||
|
|
static bool pack_by_serve = true;
|
|||
|
|
|
|||
|
|
static List<string> type_list = new List<string>();
|
|||
|
|
static bool[] t_selected;
|
|||
|
|
static List<pack_data> data_list = new List<pack_data>();
|
|||
|
|
static WWW allGame;
|
|||
|
|
//static TaurusClient web_client;
|
|||
|
|
[MenuItem("BuildTools/pack selected extend assets %_w")]
|
|||
|
|
static public void Init()
|
|||
|
|
{
|
|||
|
|
ReadGameList();
|
|||
|
|
NetManager.TIMEOUT_TIME = 60;
|
|||
|
|
BuildExtendWindow window = (BuildExtendWindow)EditorWindow.GetWindow(typeof(BuildExtendWindow), false, "扩展打包", true);
|
|||
|
|
window.ShowPopup();
|
|||
|
|
//if (web_client == null || !web_client.isConnected())
|
|||
|
|
// web_client = new TaurusClient("http://192.168.10.9:8080/", "web", ConnectionProtocol.Web);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
static void ReadGameList()
|
|||
|
|
{
|
|||
|
|
gameLit = null;
|
|||
|
|
// allGame = new WWW("http://192.168.10.9:8080/allGame?platform=" + ResourcesManager.OS_Dir + "&svr_type=" + (pro ? 1 : 0));
|
|||
|
|
string tt = Application.streamingAssetsPath +"/"+ "init1_1.json";
|
|||
|
|
allGame = new WWW(tt);//new WWW("http://47.112.97.12:8077/Config/init1_1.json");
|
|||
|
|
|
|||
|
|
while (!allGame.isDone)
|
|||
|
|
{
|
|||
|
|
// System.Threading.Thread.Sleep(2);
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(allGame.error))
|
|||
|
|
{
|
|||
|
|
UnityEngine.Debug.LogError(allGame.error);
|
|||
|
|
}
|
|||
|
|
LoadGameList();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void LoadGameList()
|
|||
|
|
{
|
|||
|
|
gameLit = (ArrayList)MiniJSON.Json.Deserialize(allGame.text);
|
|||
|
|
data_list.Clear();
|
|||
|
|
for (int i = 0; i < gameLit.Count; i++)
|
|||
|
|
{
|
|||
|
|
var tem = (Hashtable)gameLit[i];
|
|||
|
|
var bundle = tem["bundle"].ToString();
|
|||
|
|
var arr_tem = bundle.Split('.');
|
|||
|
|
string type;
|
|||
|
|
if (arr_tem.Length != 3)
|
|||
|
|
type = "";
|
|||
|
|
else
|
|||
|
|
type = arr_tem[1];
|
|||
|
|
pack_data pd = new pack_data();
|
|||
|
|
var version = tem["version"].ToString();
|
|||
|
|
pd.fillData(tem["name"].ToString(), version, tem["game_id"].ToString(), type, bundle);
|
|||
|
|
data_list.Add(pd);
|
|||
|
|
if (!type_list.Contains(type))
|
|||
|
|
{
|
|||
|
|
type_list.Add(type);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
data_list.Sort();
|
|||
|
|
t_selected = new bool[type_list.Count];
|
|||
|
|
for (int i = 0; i < type_list.Count; i++)
|
|||
|
|
t_selected[i] = true;
|
|||
|
|
show_version = show_id = true;
|
|||
|
|
|
|||
|
|
//加载配置文件,生成list
|
|||
|
|
LoadConfig();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Update()
|
|||
|
|
{
|
|||
|
|
//NetManager.processEvents();
|
|||
|
|
//if (allGame != null)
|
|||
|
|
//{
|
|||
|
|
// while (!allGame.isDone)
|
|||
|
|
// {
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
// if (!string.IsNullOrEmpty(allGame.error))
|
|||
|
|
// {
|
|||
|
|
// gameLit = null;
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
// LoadGameList();
|
|||
|
|
// allGame = null;
|
|||
|
|
// this.Repaint();
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void OnGUI()
|
|||
|
|
{
|
|||
|
|
GUI.contentColor = Color.white;
|
|||
|
|
if (gameLit == null)
|
|||
|
|
{
|
|||
|
|
GUILayout.Label("正在加载数据。。。");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
GUILayout.BeginHorizontal();
|
|||
|
|
GUILayout.Space(10);
|
|||
|
|
BuildBaseWindow.build32Lua = GUILayout.Toggle(BuildBaseWindow.build32Lua, "是否打包32位lua");
|
|||
|
|
GUILayout.Space(10);
|
|||
|
|
GUILayout.EndHorizontal();
|
|||
|
|
GUILayout.Space(10);
|
|||
|
|
|
|||
|
|
EditorGUILayout.BeginVertical("Box");
|
|||
|
|
DrawAllGames();
|
|||
|
|
GUILayout.Space(10);
|
|||
|
|
GUILayout.BeginHorizontal();
|
|||
|
|
GUI.backgroundColor = Color.yellow;
|
|||
|
|
if (GUILayout.Button("清空", GUILayout.MaxWidth(150)))
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < data_list.Count; i++)
|
|||
|
|
data_list[i].is_pack = false;
|
|||
|
|
}
|
|||
|
|
GUILayout.Space(10);
|
|||
|
|
GUI.backgroundColor = Color.Lerp(Color.red, Color.yellow, 0.5f);
|
|||
|
|
if (GUILayout.Button("上次打包", GUILayout.MaxWidth(150)))
|
|||
|
|
{
|
|||
|
|
var index = 0;
|
|||
|
|
for (int i = 0; i < data_list.Count; i++)
|
|||
|
|
{
|
|||
|
|
var tem = data_list[i];
|
|||
|
|
if (tem.getData("id") == lastpack_list[index].getData("id"))
|
|||
|
|
{
|
|||
|
|
tem.is_pack = !tem.is_pack;
|
|||
|
|
index++;
|
|||
|
|
if (index == lastpack_list.Count)
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
GUILayout.EndHorizontal();
|
|||
|
|
EditorGUILayout.EndVertical();
|
|||
|
|
|
|||
|
|
|
|||
|
|
GUILayout.Space(10f);
|
|||
|
|
GUILayout.BeginHorizontal();
|
|||
|
|
GUILayout.Space(5);
|
|||
|
|
GUI.backgroundColor = Color.cyan;
|
|||
|
|
if (GUILayout.Button("打包", GUILayout.Width(150)))
|
|||
|
|
{
|
|||
|
|
if(EditorUtility.DisplayDialog("提示", "确定打包吗?", "确定", "取消"))
|
|||
|
|
PackExtend(pro, ver_increase);
|
|||
|
|
}
|
|||
|
|
GUI.backgroundColor = Color.magenta;
|
|||
|
|
GUILayout.Space(10f);
|
|||
|
|
if (GUILayout.Button("取消", GUILayout.Width(150)))
|
|||
|
|
{
|
|||
|
|
Close();
|
|||
|
|
SaveConfig();
|
|||
|
|
}
|
|||
|
|
GUILayout.EndHorizontal();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string search_key = "";
|
|||
|
|
int search_index = 0;
|
|||
|
|
static Dictionary<string, string> pack_names;
|
|||
|
|
bool show_custom = false;
|
|||
|
|
void DrawAllGames()
|
|||
|
|
{
|
|||
|
|
GUILayout.BeginHorizontal();
|
|||
|
|
GUILayout.Label("选择类型:", GUILayout.Width(150f));
|
|||
|
|
for (int i = 0; i < type_list.Count; i++)
|
|||
|
|
{
|
|||
|
|
t_selected[i] = GUILayout.Toggle(t_selected[i], type_list[i]);
|
|||
|
|
}
|
|||
|
|
GUILayout.EndHorizontal();
|
|||
|
|
GUILayout.BeginHorizontal();
|
|||
|
|
GUILayout.Label("显示选项:", GUILayout.Width(150f));
|
|||
|
|
show_version = GUILayout.Toggle(show_version, "显示版本");
|
|||
|
|
show_id = GUILayout.Toggle(show_id, "显示ID");
|
|||
|
|
auto_show_lastpack = GUILayout.Toggle(auto_show_lastpack, "显示上次打包");
|
|||
|
|
GUILayout.EndHorizontal();
|
|||
|
|
|
|||
|
|
GUILayout.BeginHorizontal();
|
|||
|
|
GUILayout.Label("打包选项:", GUILayout.Width(150f));
|
|||
|
|
pro = GUILayout.Toggle(pro, "测试服版本(否则本地)");
|
|||
|
|
if (pro != old_pro)
|
|||
|
|
{
|
|||
|
|
old_pro = pro;
|
|||
|
|
//Init();
|
|||
|
|
ReadGameList();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
ver_increase = GUILayout.Toggle(ver_increase, "版本递增");
|
|||
|
|
//pack_by_serve = GUILayout.Toggle(pack_by_serve, "服务器打包");
|
|||
|
|
GUILayout.EndHorizontal();
|
|||
|
|
|
|||
|
|
GUILayout.BeginHorizontal();
|
|||
|
|
GUI.contentColor = Color.yellow;
|
|||
|
|
GUILayout.Label("搜索:", GUILayout.Width(30));
|
|||
|
|
string[] search_type = { "name", "id", "version" };
|
|||
|
|
search_index = GUILayout.SelectionGrid(search_index, search_type, 3, GUILayout.Height(15), GUILayout.Width(180));
|
|||
|
|
search_key = GUILayout.TextField(search_key, GUILayout.Width(200));
|
|||
|
|
GUI.contentColor = Color.white;
|
|||
|
|
GUILayout.EndHorizontal();
|
|||
|
|
|
|||
|
|
GUI.backgroundColor = Color.green;
|
|||
|
|
EditorGUILayout.BeginVertical("box");
|
|||
|
|
var all_tem = GUILayout.Toggle(all_selected, "全选");
|
|||
|
|
|
|||
|
|
if (all_tem != obl_all_selected)
|
|||
|
|
{
|
|||
|
|
all_selected = all_tem;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
int column_width = 150;
|
|||
|
|
int table_width = 20;
|
|||
|
|
int column_num = (int)((position.width - table_width) / column_width);
|
|||
|
|
int column_index = 1;
|
|||
|
|
GUILayout.BeginVertical();
|
|||
|
|
for (int i = 0; i < data_list.Count; i++)
|
|||
|
|
{
|
|||
|
|
var tem = data_list[i];
|
|||
|
|
var index = type_list.IndexOf(tem.getData("type"));
|
|||
|
|
if (t_selected[index])
|
|||
|
|
{
|
|||
|
|
if (column_index == 1)
|
|||
|
|
{
|
|||
|
|
GUILayout.BeginHorizontal();
|
|||
|
|
GUILayout.Space(table_width);
|
|||
|
|
}
|
|||
|
|
if (search_key == "" || tem.getData(search_type[search_index]).ToString().Contains(search_key))
|
|||
|
|
{
|
|||
|
|
if (all_tem != obl_all_selected)
|
|||
|
|
{
|
|||
|
|
tem.is_pack = all_tem;
|
|||
|
|
}
|
|||
|
|
string toggle_name = tem.getData("name");
|
|||
|
|
if (show_id) toggle_name = "[" + tem.getData("id") + "]" + toggle_name;
|
|||
|
|
if (show_version) toggle_name = toggle_name + "[" + tem.getData("version") + "]";
|
|||
|
|
tem.is_pack = GUILayout.Toggle(tem.is_pack, toggle_name, GUILayout.Width(column_width));
|
|||
|
|
}
|
|||
|
|
if (column_index == column_num || (i == data_list.Count - 1 && column_index < column_num))
|
|||
|
|
{
|
|||
|
|
column_index = 1;
|
|||
|
|
GUILayout.EndHorizontal();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
column_index++;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
tem.is_pack = false;
|
|||
|
|
}
|
|||
|
|
//GUILayout.EndHorizontal();
|
|||
|
|
obl_all_selected = all_selected;
|
|||
|
|
GUILayout.EndVertical();
|
|||
|
|
EditorGUILayout.EndVertical();
|
|||
|
|
|
|||
|
|
GUIStyle toggleStyle = new GUIStyle();
|
|||
|
|
toggleStyle.fontStyle = FontStyle.Bold;
|
|||
|
|
EditorGUILayout.BeginVertical("box");
|
|||
|
|
EditorGUILayout.BeginHorizontal();
|
|||
|
|
show_custom = GUILayout.Toggle(show_custom, "自定义", toggleStyle, GUILayout.Width(100));
|
|||
|
|
if (show_custom)
|
|||
|
|
{
|
|||
|
|
GUILayout.Space(10);
|
|||
|
|
GUI.backgroundColor = Color.Lerp(Color.blue, Color.white, 0.5f);
|
|||
|
|
if (GUILayout.Button(editable ? "应用" : "编辑", GUILayout.MaxWidth(100)))
|
|||
|
|
{
|
|||
|
|
editable = !editable;
|
|||
|
|
}
|
|||
|
|
GUI.backgroundColor = Color.LerpUnclamped(Color.red, Color.white, 0.1f);
|
|||
|
|
if (!editable && GUILayout.Button("复制选中游戏", GUILayout.MaxWidth(100)))
|
|||
|
|
{
|
|||
|
|
string str_copy = "";
|
|||
|
|
for (int i = 0; i < data_list.Count; i++)
|
|||
|
|
{
|
|||
|
|
var tem = data_list[i];
|
|||
|
|
if (tem.is_pack)
|
|||
|
|
{
|
|||
|
|
str_copy += "," + data_list[i].getData("name");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
str_copy = str_copy.Substring(1);
|
|||
|
|
TextEditor t = new TextEditor();
|
|||
|
|
t.content = new GUIContent(str_copy);
|
|||
|
|
t.OnFocus();
|
|||
|
|
t.Copy();
|
|||
|
|
}
|
|||
|
|
if (!editable && GUILayout.Button("选中游戏版本日志", GUILayout.MaxWidth(100)))
|
|||
|
|
{
|
|||
|
|
string str_copy = "";
|
|||
|
|
for (int i = 0; i < data_list.Count; i++)
|
|||
|
|
{
|
|||
|
|
var tem = data_list[i];
|
|||
|
|
if (tem.is_pack)
|
|||
|
|
{
|
|||
|
|
str_copy += string.Format(",{0}({1})", data_list[i].getData("name"), data_list[i].getData("version"));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
str_copy = str_copy.Substring(1);
|
|||
|
|
TextEditor t = new TextEditor();
|
|||
|
|
t.content = new GUIContent(str_copy);
|
|||
|
|
t.OnFocus();
|
|||
|
|
t.Copy();
|
|||
|
|
}
|
|||
|
|
GUI.backgroundColor = Color.Lerp(Color.green, Color.yellow, 0.5f);
|
|||
|
|
if (editable)
|
|||
|
|
{
|
|||
|
|
if (GUILayout.Button("+", GUILayout.Width(100)))
|
|||
|
|
{
|
|||
|
|
Hashtable tem = new Hashtable();
|
|||
|
|
string name = "新建打包对象";
|
|||
|
|
tem["name"] = name;
|
|||
|
|
Hashtable games = new Hashtable();
|
|||
|
|
tem["pack"] = games;
|
|||
|
|
var n = customs_pack.Count;
|
|||
|
|
while (customs_pack.ContainsKey(n.ToString()))
|
|||
|
|
{ n++; }
|
|||
|
|
customs_pack.Add(n.ToString(), tem);
|
|||
|
|
pack_names.Add(n.ToString(), name);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
EditorGUILayout.EndHorizontal();
|
|||
|
|
if (show_custom)
|
|||
|
|
{
|
|||
|
|
GUILayout.Space(5);
|
|||
|
|
if (customs_pack.Count == 0)
|
|||
|
|
{
|
|||
|
|
GUILayout.Label("没有数据");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
List<string> del_list = new List<string>();
|
|||
|
|
foreach (DictionaryEntry de in customs_pack)
|
|||
|
|
{
|
|||
|
|
GUILayout.BeginHorizontal();
|
|||
|
|
var tem = (Hashtable)de.Value;
|
|||
|
|
|
|||
|
|
var pack = (Hashtable)tem["pack"];
|
|||
|
|
string pack_name = tem["name"].ToString();
|
|||
|
|
if (editable)
|
|||
|
|
pack_names[de.Key.ToString()] = GUILayout.TextField(pack_names[de.Key.ToString()], GUILayout.Width(80));
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (GUILayout.Button("·", GUILayout.Width(20)))
|
|||
|
|
{
|
|||
|
|
if (pack.Count > 0)
|
|||
|
|
{
|
|||
|
|
int index = 0;
|
|||
|
|
for (int j = 0; j < data_list.Count; j++)
|
|||
|
|
{
|
|||
|
|
var game_name = pack[index.ToString()].ToString();
|
|||
|
|
var d = data_list[j];
|
|||
|
|
if (game_name == d.getData("name"))
|
|||
|
|
{
|
|||
|
|
d.is_pack = !d.is_pack;
|
|||
|
|
index++;
|
|||
|
|
if (index == pack.Count)
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
GUILayout.Label(pack_name, GUILayout.Width(80));
|
|||
|
|
}
|
|||
|
|
string context = "";
|
|||
|
|
for (int j = 0; j < pack.Count; j++)
|
|||
|
|
{
|
|||
|
|
context += pack[j.ToString()].ToString() + ",";
|
|||
|
|
}
|
|||
|
|
GUILayout.Label(context, GUILayout.Width(300));
|
|||
|
|
if (editable)
|
|||
|
|
{
|
|||
|
|
if (GUILayout.Button("确定"))
|
|||
|
|
{
|
|||
|
|
pack.Clear();
|
|||
|
|
int l = 0;
|
|||
|
|
for (int k = 0; k < data_list.Count; k++)
|
|||
|
|
{
|
|||
|
|
var d = data_list[k];
|
|||
|
|
if (d.is_pack)
|
|||
|
|
{
|
|||
|
|
pack.Add(l.ToString(), d.getData("name"));
|
|||
|
|
l++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
tem["name"] = pack_names[de.Key.ToString()];
|
|||
|
|
}
|
|||
|
|
GUI.backgroundColor = Color.red;
|
|||
|
|
if (GUILayout.Button("-"))
|
|||
|
|
{
|
|||
|
|
del_list.Add(de.Key.ToString());
|
|||
|
|
}
|
|||
|
|
GUI.backgroundColor = Color.Lerp(Color.green, Color.yellow, 0.5f);
|
|||
|
|
}
|
|||
|
|
GUILayout.EndHorizontal();
|
|||
|
|
}
|
|||
|
|
//删除
|
|||
|
|
for (int i = 0; i < del_list.Count; i++)
|
|||
|
|
{
|
|||
|
|
customs_pack.Remove(del_list[i]);
|
|||
|
|
pack_names.Remove(del_list[i]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
EditorGUILayout.EndVertical();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void PackExtend(bool pro, bool ver_increase)
|
|||
|
|
{
|
|||
|
|
List<pack_data> list = data_list;
|
|||
|
|
if (list.Count == 0) return;
|
|||
|
|
ArrayList al = new ArrayList();
|
|||
|
|
ITArray arr = TArray.newInstance();
|
|||
|
|
var count = 0;
|
|||
|
|
bool dont_clean_list = true;
|
|||
|
|
string str_log = "客户端 测试服:\r";
|
|||
|
|
for (int i = 0; i < list.Count; i++)
|
|||
|
|
{
|
|||
|
|
al.Clear();
|
|||
|
|
var pd = list[i];
|
|||
|
|
|
|||
|
|
var version = pd.getData("version");
|
|||
|
|
var new_version = version;
|
|||
|
|
if (ver_increase)
|
|||
|
|
{
|
|||
|
|
var arr_ver = version.Split('.');
|
|||
|
|
if (arr_ver.Length == 3)
|
|||
|
|
{
|
|||
|
|
var min_ver = Convert.ToInt32(arr_ver[2]) + 1;
|
|||
|
|
new_version = string.Format("{0}.{1}.{2}", arr_ver[0], arr_ver[1], min_ver.ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (pd.is_pack) //(!pack_by_serve)
|
|||
|
|
{
|
|||
|
|
//al.Add(pd);
|
|||
|
|
Hashtable tem = new Hashtable();
|
|||
|
|
tem["name"] = pd.getData("name");
|
|||
|
|
tem["game_id"] = int.Parse(pd.getData("id"));
|
|||
|
|
tem["version"] = new_version;
|
|||
|
|
tem["is_pack"] = pd.is_pack;
|
|||
|
|
tem["bundle"] = pd.getData("bundle");
|
|||
|
|
al.Add((object)tem);
|
|||
|
|
}
|
|||
|
|
//if (pd.is_pack)
|
|||
|
|
//{W
|
|||
|
|
// arr.addInt(int.Parse(pd.getData("id")));
|
|||
|
|
// if (dont_clean_list)
|
|||
|
|
// {
|
|||
|
|
// dont_clean_list = false;
|
|||
|
|
// last_pack.Clear();
|
|||
|
|
// }
|
|||
|
|
// last_pack.Add(count, pd.getData("name"));
|
|||
|
|
// count++;
|
|||
|
|
//}
|
|||
|
|
if (pd.is_pack)
|
|||
|
|
str_log += string.Format("{0}({1}) ", pd.getData("name"), new_version);
|
|||
|
|
|
|||
|
|
if (pd.is_pack)
|
|||
|
|
{
|
|||
|
|
PackUtil.Specify_Pack_Custom(EditorUserBuildSettings.activeBuildTarget, al);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//if (!pack_by_serve)
|
|||
|
|
//{
|
|||
|
|
// PackUtil.Specify_Pack_Custom(BuildTarget.Android,al);
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// ITObject param = TObject.newInstance();
|
|||
|
|
// param.putInt("svr_type", pro ? 1 : 0);
|
|||
|
|
// ITArray platforms = TArray.newInstance();
|
|||
|
|
// param.putTArray("list", arr);
|
|||
|
|
// EditorUtility.DisplayProgressBar("正在生成", "服务器正在打包请稍后。。。", 0.2f);
|
|||
|
|
// web_client.send("pack/pack_extend", param, (res) =>
|
|||
|
|
// {
|
|||
|
|
// EditorUtility.ClearProgressBar();
|
|||
|
|
// web_client.killConnection();
|
|||
|
|
// Close();
|
|||
|
|
// });
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
TextEditor t = new TextEditor();
|
|||
|
|
t.content = new GUIContent(str_log);
|
|||
|
|
t.OnFocus();
|
|||
|
|
t.Copy();
|
|||
|
|
SaveConfig();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static Hashtable last_pack = new Hashtable();
|
|||
|
|
static Hashtable customs_pack = new Hashtable();
|
|||
|
|
void SaveConfig()
|
|||
|
|
{
|
|||
|
|
var path = Application.persistentDataPath + "../../../u3dpack";
|
|||
|
|
if (!Directory.Exists(path))
|
|||
|
|
Directory.CreateDirectory(path);
|
|||
|
|
var file = path + "/pack.json";
|
|||
|
|
var fs = File.Create(file);
|
|||
|
|
fs.Close();
|
|||
|
|
Hashtable data = new Hashtable();
|
|||
|
|
data.Add("last_pack", last_pack);
|
|||
|
|
data.Add("customs_pack", customs_pack);
|
|||
|
|
data.Add("auto_show_lastpack", auto_show_lastpack);
|
|||
|
|
var json_str = Json.Serialize((object)data);
|
|||
|
|
File.WriteAllText(file, json_str);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static List<pack_data> lastpack_list = new List<pack_data>();
|
|||
|
|
static void LoadConfig()
|
|||
|
|
{
|
|||
|
|
var path = Application.persistentDataPath + "../../../u3dpack";
|
|||
|
|
if (!Directory.Exists(path) || !File.Exists(path + "/pack.json"))
|
|||
|
|
packData = null;
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
var json_data = File.ReadAllText(path + "/pack.json");
|
|||
|
|
packData = Json.Deserialize(json_data) as Hashtable;
|
|||
|
|
last_pack = (Hashtable)packData["last_pack"];
|
|||
|
|
customs_pack = (Hashtable)packData["customs_pack"];
|
|||
|
|
auto_show_lastpack = (bool)packData["auto_show_lastpack"];
|
|||
|
|
|
|||
|
|
pack_names = new Dictionary<string, string>();
|
|||
|
|
foreach (DictionaryEntry de in customs_pack)
|
|||
|
|
{
|
|||
|
|
var tem = (Hashtable)de.Value;
|
|||
|
|
pack_names.Add(de.Key.ToString(), tem["name"].ToString());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var index = 0;
|
|||
|
|
for (int i = 0; i < data_list.Count; i++)
|
|||
|
|
{
|
|||
|
|
var tem = data_list[i];
|
|||
|
|
string game_name = "";
|
|||
|
|
if (last_pack.Count > 0)
|
|||
|
|
game_name = last_pack[index.ToString()].ToString();
|
|||
|
|
if (tem.getData("name") == game_name)
|
|||
|
|
{
|
|||
|
|
lastpack_list.Add(tem);
|
|||
|
|
if (auto_show_lastpack)
|
|||
|
|
tem.is_pack = true;
|
|||
|
|
index++;
|
|||
|
|
if (index == last_pack.Count)
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//var lp = (Hashtable)packData["last_pack"];
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
string UnicodeToString(string srcText)
|
|||
|
|
{
|
|||
|
|
string dst = "";
|
|||
|
|
string src = srcText;
|
|||
|
|
int len = srcText.Length / 6;
|
|||
|
|
for (int i = 0; i <= len - 1; i++)
|
|||
|
|
{
|
|||
|
|
string str = "";
|
|||
|
|
str = src.Substring(0, 6).Substring(2);
|
|||
|
|
src = src.Substring(6);
|
|||
|
|
byte[] bytes = new byte[2];
|
|||
|
|
bytes[1] = byte.Parse(int.Parse(str.Substring(0, 2), System.Globalization.NumberStyles.HexNumber).ToString());
|
|||
|
|
bytes[0] = byte.Parse(int.Parse(str.Substring(2, 2), System.Globalization.NumberStyles.HexNumber).ToString());
|
|||
|
|
dst += Encoding.Unicode.GetString(bytes);
|
|||
|
|
}
|
|||
|
|
return dst;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
new void Close()
|
|||
|
|
{
|
|||
|
|
base.Close();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|