Commit 42e43354 authored by Ever's avatar Ever

優化重播邏輯

parent 465bb344
......@@ -95,6 +95,19 @@ public class GameEditor
Debug.Log("循环次数:" + count);
png.Apply();
}
[MenuItem("Tools/清理缓存")]
public static void 清理缓存()
{
string path = Application.persistentDataPath + $"/MyPic";
if (Directory.Exists(path))
{
Directory.Delete(path, true);
}
}
}
......@@ -178,7 +178,7 @@ public class GameMgr : MonoBehaviour
}
public List<int> rePlayList = new List<int>();
public float maxTime = 1;
public float maxTime = 0.1f;
public float curTime = 0;
public void Play()
{
......@@ -197,7 +197,7 @@ public class GameMgr : MonoBehaviour
Debug.Log("进入:" + rePlayList[0] + "_rePlayList.Count=" + rePlayList.Count);
Vector2 v = new Vector2(md.json.roomDatas[i].px, md.json.roomDatas[i].py);
Debug.Log("模拟点击:" + v);
md.OnClickPos(v);
md.OnClickPos(v, true);
rePlayList.RemoveAt(0);
break;
}
......
......@@ -42,13 +42,13 @@ public class MainData : MonoBehaviour
transform.parent.localScale = Vector3.one * s;
transform.parent.localPosition = new Vector3(config.x, config.y, 0);
GameMgr.Ins.tiMgr.Init(json, png);
GameMgr.Ins.tiMgr.SizeChange(s);
GameMgr.Ins.tiMgr.SizeChange(s, true);
EventDispatcher.Dispatch(EventName.Event.Event_GroupListCreate, json.roomGroupsData);
}
public bool OnClickPos(Vector2 v)
public bool OnClickPos(Vector2 v, bool b = false)
{
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
......@@ -68,7 +68,7 @@ public class MainData : MonoBehaviour
return false;
}
int id = json.allPos[(int)(v.x + v.y * png.width)];
if (FunDo(id, v))
if (FunDo(id, v, b))
{
sw.Stop();
Debug.Log("耗时:" + sw.ElapsedMilliseconds);
......@@ -76,13 +76,13 @@ public class MainData : MonoBehaviour
}
return false;
}
public bool FunDo(int id, Vector2 v)
public bool FunDo(int id, Vector2 v, bool b = false)
{
for (int i = 0; i < json.roomGroupsData.Count; i++)
{
if (json.roomGroupsData[i].roomIds.Contains(id))
{
if (json.roomGroupsData[i].id == curGroupId)
if (json.roomGroupsData[i].id == curGroupId || b)
{
ExRoomDatas erd = new ExRoomDatas();
json.roomGroupsData[i].roomIds.Remove(id);
......
......@@ -70,9 +70,9 @@ public class TextItemMgr : MonoBehaviour
}
public static float size = 1; //当前缩放倍数
public static Vector4 param = new Vector4(0.3f, 25, 0.1f, 1); // x的值以下隐藏 y:缩放等于x的缩放倍数的时候,大于等于y这个字号的字显示 z:基于x、y 每增加z值的缩放,w:允许显示的字
public void SizeChange(float f)
public void SizeChange(float f, bool b = false)
{
if (size == f)
if (size == f && b == false)
{
return;
}
......
......@@ -36,8 +36,8 @@ RectTransform:
m_Father: {fileID: 136994829194703267}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
......@@ -609,8 +609,8 @@ MonoBehaviour:
png: {fileID: 0}
jpg: {fileID: 0}
json:
list:
All:
step:
allPos:
roomDatas: []
roomGroupsData: []
colorDiff: 0
......@@ -1023,6 +1023,9 @@ MonoBehaviour:
tiMgr: {fileID: 1490190831900560014}
giMgr: {fileID: 2042267472393982796}
gray: {fileID: 2800000, guid: cfe63fc6a2e3edc409d653cefd205fb7, type: 3}
rePlayList:
maxTime: 1
curTime: 0
--- !u!1 &8927003478227325637
GameObject:
m_ObjectHideFlags: 0
......
......@@ -1763,13 +1763,13 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
public void StartGame()
{
var obj = Resources.Load<GameObject>("perfabs/GameMgr");
var item = GameObject.Instantiate(obj).transform;
GameMgr obj = Resources.Load<GameMgr>("perfabs/GameMgr");
GameMgr item = Instantiate<GameMgr>(obj);
item.SetParent(MrgParent);
item.localPosition= Vector3.zero;
item.localRotation = Quaternion.Euler(0, 0, 0);
item.localScale= Vector3.one;
item.transform.SetParent(MrgParent);
item.transform.localPosition= Vector3.zero;
item.transform.localRotation = Quaternion.Euler(0, 0, 0);
item.transform.localScale= Vector3.one;
EventDispatcher.Dispatch(EventName.Event.Event_LoadingChange); //开始初始化
string path = Application.persistentDataPath + $"/MyPic/cc2D9Z2w9k0evqUiCQ/";
......@@ -1784,12 +1784,12 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
var jsondata = getdata("cc2D9Z2w9k0evqUiCQ");
item.GetComponent<GameMgr>().Init("cc2D9Z2w9k0evqUiCQ",png, jpg, jsondata);
item.Init("cc2D9Z2w9k0evqUiCQ",png, jpg, jsondata);
SaveManager.Instance.SaveRes("cc2D9Z2w9k0evqUiCQ", jsondata, png);
//SaveManager.Instance.SaveJPG("cc2D9Z2w9k0evqUiCQ", jpg_texture);
}
IEnumerator LoadPic(string dirpath,string name,Transform item)
IEnumerator LoadPic(string dirpath,string name, GameMgr item)
{
Texture2D png=null;
Sprite jpg=null;
......@@ -1834,13 +1834,13 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
if (localflag) //加载本地的到这里就回去了,下面是第一次
{
item.GetComponent<GameMgr>().Init("cc2D9Z2w9k0evqUiCQ", png, jpg, jsondata);
item.Init("cc2D9Z2w9k0evqUiCQ", png, jpg, jsondata);
yield break;
}
SaveManager.Instance.SaveRes("cc2D9Z2w9k0evqUiCQ", jsondata, png);
SaveManager.Instance.SaveJPG("cc2D9Z2w9k0evqUiCQ", item.GetComponent<GameMgr>().md.jpg.texture);
SaveManager.Instance.SaveJPG("cc2D9Z2w9k0evqUiCQ", jpg_texture);
while (!SaveManager.Instance.IsSaveOver)
{
......@@ -1861,7 +1861,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
}
jsondata = getdata("cc2D9Z2w9k0evqUiCQ");
item.GetComponent<GameMgr>().Init("cc2D9Z2w9k0evqUiCQ", png, jpg, jsondata);
item.Init("cc2D9Z2w9k0evqUiCQ", png, jpg, jsondata);
}
......
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