Commit d1dbc732 authored by lijin's avatar lijin

重播BUG

parent 0aa237e1
......@@ -55,6 +55,7 @@ public class GameMgr : MonoBehaviour
public void RePlay()
{
md.RePlay();
maxTime = 2f / md.dynamic.step.Count;
stepIndex = 0;
curTime = 0;
}
......@@ -150,7 +151,7 @@ public class GameMgr : MonoBehaviour
#region 涂色重播逻辑
private int stepIndex = -1;//重播判断值,-1不处理,0及以上为重播到第几步
private static readonly float delay = 0.5f;//重播延迟
private static readonly float maxTime = 0.1f;//重播步间隔
private static float maxTime = 0.1f;//重播步间隔
private float curTime = 0;//重播当前进行时间
//Update调用判断逻辑
private void Play()
......
......@@ -10,7 +10,7 @@ public class MaskItem : MonoBehaviour
public int groupId = -1;
public float IsUse = -1;
public Image SP;
public RectTransform Rect;
public RectTransform rect;
public RectTransform SPRect;
public Vector4 size;
// Update is called once per frame
......@@ -20,8 +20,8 @@ public class MaskItem : MonoBehaviour
{
return;
}
Rect.sizeDelta += Time.deltaTime * Vector2.one * IsUse * 3f;
if (Rect.sizeDelta.x > IsUse * 1.05f && Rect.sizeDelta.y > IsUse * 1.5f)
rect.sizeDelta += Time.deltaTime * Vector2.one * IsUse * 3f;
if (rect.sizeDelta.x > IsUse * 1.05f && rect.sizeDelta.y > IsUse * 1.5f)
{
IsUse = -1;
Hide();
......@@ -55,19 +55,19 @@ public class MaskItem : MonoBehaviour
SP.GetComponent<RectTransform>().sizeDelta = new Vector2(te.width, te.height);
//坐标计算
Transform p = Rect.parent;
Rect.SetParent(md.imgpng.transform);
Rect.localPosition = Vector3.zero;
Rect.SetParent(p);
Rect.localScale = Vector2.one;
Transform p = rect.parent;
rect.SetParent(md.imgpng.transform);
rect.localPosition = Vector3.zero;
rect.SetParent(p);
rect.localScale = Vector2.one;
SPRect.SetParent(md.imgpng.transform);
SPRect.localPosition = new Vector3(erd.size.x + (erd.size.z + 1 - erd.size.x) / 2 - (md.json.width + 1) / 2, erd.size.y + (erd.size.w + 1 - erd.size.y) / 2 - (md.json.height + 1) / 2, 0);
SPRect.SetParent(Rect);
SPRect.SetParent(rect);
SPRect.localScale = Vector2.one;
//初始处理
Rect.sizeDelta = Vector2.zero;
rect.sizeDelta = Vector2.zero;
size = erd.size;
}
......@@ -83,6 +83,7 @@ public class MaskItem : MonoBehaviour
public void Show()
{
IsUse = -1;
rect.sizeDelta = Vector2.zero;
gameObject.SetActive(true);
}
public void Hide()
......@@ -94,12 +95,12 @@ public class MaskItem : MonoBehaviour
MainData md = GameMgr.Ins.md;
SPRect.SetParent(md.imgpng.transform);
Transform p = Rect.parent;
Rect.SetParent(md.imgpng.transform);
Rect.localPosition = v - new Vector3(md.json.width / 2, md.json.height / 2);
Rect.SetParent(p);
Transform p = rect.parent;
rect.SetParent(md.imgpng.transform);
rect.localPosition = v - new Vector3(md.json.width / 2, md.json.height / 2);
rect.SetParent(p);
SPRect.SetParent(Rect);
SPRect.SetParent(rect);
float a = Math.Max(size.z - v.x, v.x - size.x);
float b = Math.Max(size.w - v.y, v.y - size.y);
......
......@@ -121,15 +121,15 @@ public class MaskItemMgr : MonoBehaviour
{
for (int i = 0; i < useList.Count; i++)
{
if (GameMgr.Ins.md.dynamic.step.Contains(useList[i].roomId))
{
useList[i].Show();
useList[i].Rect.sizeDelta = Vector2.zero;
}
else
{
useList[i].Hide();
}
useList[i].Hide();
}
List<int> l = GameMgr.Ins.md.dynamic.step;
for (int i = 0; i < l.Count; i++)
{
RoomDatas rd = GameMgr.Ins.md.json.roomDatas[l[i]];
RoomGroupsData rgd = GameMgr.Ins.md.json.roomGroupsData[rd.groupId];
MaskItem item = IsHave(rgd, rd);
item.Show();
}
}
}
\ No newline at end of file
......@@ -179,6 +179,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
roomId: -1
groupId: -1
Text: {fileID: 1434280649147581400}
--- !u!114 &1434280649147581400
MonoBehaviour:
......@@ -5753,12 +5754,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c99b850a1f8be4640b391afdbd751ee8, type: 3}
m_Name:
m_EditorClassIdentifier:
bigArea: 0
roomId: -1
groupId: -1
IsUse: -1
SP: {fileID: 7114594662145661671}
Rect: {fileID: 3859749812772851665}
rect: {fileID: 3859749812772851665}
SPRect: {fileID: 4668905872759166448}
size: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &5487798596680419126
......@@ -5896,7 +5896,6 @@ MonoBehaviour:
tiMgr: {fileID: 1490190831900560014}
eiMgr: {fileID: 3661810172065829162}
gray: {fileID: 2800000, guid: cfe63fc6a2e3edc409d653cefd205fb7, type: 3}
saveTime: -1
--- !u!114 &977886392249047969
MonoBehaviour:
m_ObjectHideFlags: 0
......
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