Commit 9ecf27e1 authored by Ever's avatar Ever

更新代码

parent d26ef371
This diff is collapsed.
......@@ -8,6 +8,7 @@ public class LoadingPanel : MonoBehaviour
{
public Slider JIndu;
public Transform PicParent;
// Start is called before the first frame update
void Start()
{
......@@ -25,11 +26,18 @@ public class LoadingPanel : MonoBehaviour
private void ClosePanel(object[] values)
{
gameObject.SetActive(false);
StartCoroutine(DelayClose());
}
IEnumerator DelayClose()
{
yield return new WaitForSeconds(0.2f);
gameObject.SetActive(false);
}
float jindu = 0;
private void ChangeSlider(object[] values)
{
//JIndu.value = value;
jindu += 0.1f;//(float)values[0];
JIndu.value = jindu;
}
}
......@@ -39,7 +39,6 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
public float tempValue2 = 130f;
private float tempValue3 = 5f;
public ReplayCam cam;
public float ListMoveOffSet = 35;
public Transform PlayImagePaent; //操作的图片的父节点
......@@ -499,6 +498,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
else
{
EventDispatcher.Dispatch(EventName.Event.Event_LoadingChange);
return 0; //下载完后先不操作了
utilsTools.delTimeHandler(gameObject, "tryDownColorImg");
Image image = transform.Find("ingameLoad/loadImg").GetComponent<Image>();
......@@ -516,6 +516,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}
void onZipFileHandler(GameScenUserInfo gameScenUser)
{
EventDispatcher.Dispatch(EventName.Event.Event_LoadingChange);//下载完成
Debug.Log("handlerLoadingPosition hand begin");
string zpath = utilsTools.getWritableByPath("outFiles/" + gameScenUser.id + ".zip");
if (utilsTools.IsWin == true)
......@@ -555,6 +556,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
//下载和解压zip 没有下载过就去下载线稿图
void onInitViewShowDataEvent(List<UnityEngine.Object> uobjects, List<System.Object> objects)
{
EventDispatcher.Dispatch(EventName.Event.Event_LoadingChange); //开始下载或者解压
utilsTools.setGDataByKey("firstT", utilsTools.getTotalMillisecond());
GameScenUserInfo gameScenUser = (GameScenUserInfo)objects[0];
string zpath = utilsTools.getWritableByPath("outFiles/" + gameScenUser.id+".zip");
......@@ -855,21 +857,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
}, 40);
}
/// <summary>
/// 开始录屏,调用ReplayCam.StartRecording()方法
/// </summary>
public void StartRectord()
{
cam.StartRecording();
}
/// <summary>
/// 结束录屏,调用ReplayCam.StopRectord()方法
/// </summary>
public void StopRectord()
{
Debug.Log($"录制结束");
cam.StopRecording();
}
public void onTestTemp1()
{
//Image image = transform.Find("ingameLoad/loadImg").GetComponent<Image>();
......
......@@ -38,6 +38,34 @@ public class GroupListManager : MonoBehaviour
AllProcress_Text.gameObject.SetActive(true);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.A))
{
List<short> list = new List<short>();
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < 2048; j++)
{
list.Add((short)UnityEngine.Random.Range(0, 1000));
}
}
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
for (int i = 0; i < 12; i++)
{
sw.Start();
for (int j = 0; j < list.Count; j++)
{
}
sw.Stop();
Debug.Log("耗时:" + sw.ElapsedMilliseconds);
}
}
}
private void ResiterEvent(bool flag)
{
EventDispatcher.RegisterEvent(EventName.Event.Event_GroupListCreate, CreateGroup, flag);
......
......@@ -599,7 +599,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
else
{
DownLoadFileinfos.Add(url);
EventDispatcher.Dispatch(EventName.Event.Event_LoadingChange); //加载完成
if (DownLoadFileinfos.Count >= 3)
{
StartGame();
......@@ -652,6 +652,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
}
else
{
EventDispatcher.Dispatch(EventName.Event.Event_LoadingChange);//加载完成
DownLoadFileinfos.Add(url);
if (DownLoadFileinfos.Count >= 3)
{
......@@ -766,12 +767,15 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
bytesInitDigitMatrix(bytes);
Debug.Log("bin初始化完成--------------");
});
utilsTools.setGDataByKey("loadBinEnd", utilsTools.getTotalMillisecond());
utilsTools.setGDataByKey("downJson", utilsTools.getTotalMillisecond());
//utilsTools.setGDataByKey("loadBinEnd", utilsTools.getTotalMillisecond());
//utilsTools.setGDataByKey("downJson", utilsTools.getTotalMillisecond());
EventDispatcher.Dispatch(EventName.Event.Event_LoadingChange); //开始加载文件
loadFileInfo(gameUserInfo.json, jsonPath, 3);
utilsTools.setGDataByKey("loadGaoQing", utilsTools.getTotalMillisecond());
//utilsTools.setGDataByKey("loadGaoQing", utilsTools.getTotalMillisecond());
loadFileInfo(gameUserInfo.img, linePath, 1);
utilsTools.setGDataByKey("loadJpg", utilsTools.getTotalMillisecond());
//utilsTools.setGDataByKey("loadJpg", utilsTools.getTotalMillisecond());
loadFileInfo(gameUserInfo.finishImg, colorPath, 2);
return true;
}
......@@ -1724,7 +1728,9 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
var jsondata = getdata();
EventDispatcher.Dispatch(EventName.Event.Event_LoadingChange); //开始初始化
item.GetComponent<GameMgr>().Init(png, jpg, jsondata);
}
......
......@@ -25,22 +25,28 @@ public class SaveManager : MonoBehaviour
instance = this;
}
public void SaveBin(string pngname,ResJsonData data)
public void SaveRes(string key, ResJsonData data, Texture2D png)
{
SaveBin(key,data);
SavePng(key,png);
}
public void SaveBin(string key,ResJsonData data)
{
string json= JsonUtility.ToJson(data);
SaveBin(pngname,json);
SaveBin(key,json);
}
/// <summary>
/// 保存bin文件
/// </summary>
/// <param name="path"></param>
/// <param name="json"></param>
public void SaveBin(string pngname, string json)
/// <param key="path"></param>
/// <param key="json"></param>
public void SaveBin(string key, string json)
{
FileStream fs = new FileStream(SavePath+$"{name}.bin", FileMode.Create, FileAccess.Write);
FileStream fs = new FileStream(SavePath+$"{key}.bin", FileMode.Create, FileAccess.Write);
BinaryFormatter saveBf = new BinaryFormatter();
saveBf.Serialize(fs, json);
fs.Close();
......@@ -51,41 +57,20 @@ public class SaveManager : MonoBehaviour
/// </summary>
/// <param name="path"></param>
/// <param name="png"></param>
public void SavePng(Texture2D png)
public void SavePng(string key,Texture2D png)
{
//var colors = png.GetPixels();
//for (int i = 0; i < png.width; i+=2)
//{
// for (int j = 0; j < png.height; j+=2)
// {
// png.SetPixel(i, j, new Color(1, 1, 1, 1));
// }
//}
//png.Apply();
byte[] dataBytes = png.EncodeToPNG();
FileStream fs = File.Open(SavePath+$"{png.name}.png", FileMode.OpenOrCreate);
FileStream fs = File.Open(SavePath+$"{key}.png", FileMode.OpenOrCreate);
fs.Write(dataBytes, 0, dataBytes.Length);
fs.Flush();
fs.Close();
}
public void SaveJPG(Texture2D png)
public void SaveJPG(string key, Texture2D png)
{
//var colors = png.GetPixels();
//for (int i = 0; i < png.width; i+=2)
//{
// for (int j = 0; j < png.height; j+=2)
// {
// png.SetPixel(i, j, new Color(1, 1, 1, 1));
// }
//}
//png.Apply();
byte[] dataBytes = png.EncodeToPNG();
FileStream fs = File.Open(SavePath + $"{png.name}.jpg", FileMode.OpenOrCreate);
FileStream fs = File.Open(SavePath + $"{key}.jpg", FileMode.OpenOrCreate);
fs.Write(dataBytes, 0, dataBytes.Length);
fs.Flush();
fs.Close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment