Commit af60fe6c authored by mercury233's avatar mercury233

make HashedButtons don't move

parent 33db0174
...@@ -7,6 +7,8 @@ public class gameUIbutton ...@@ -7,6 +7,8 @@ public class gameUIbutton
public string hashString; public string hashString;
public GameObject gameObject; public GameObject gameObject;
public int response; public int response;
public bool dying;
public bool dead;
} }
public class gameInfo : MonoBehaviour public class gameInfo : MonoBehaviour
...@@ -120,25 +122,41 @@ public class gameInfo : MonoBehaviour ...@@ -120,25 +122,41 @@ public class gameInfo : MonoBehaviour
opponent.transform.localPosition = new Vector3(Screen.width / 2-14, Screen.height / 2 - 14 - k * (float)(opponent.under.height)); opponent.transform.localPosition = new Vector3(Screen.width / 2-14, Screen.height / 2 - 14 - k * (float)(opponent.under.height));
} }
float height = 132 + 50 * (HashedButtons.Count); width = (150 * kb) + 15f;
if (HashedButtons.Count==0)
{
height = 116;
}
width = (150 * kb) + 15f;
float localPositionPanX = (((float)Screen.width - 150 * kb) / 2) - 15f; float localPositionPanX = (((float)Screen.width - 150 * kb) / 2) - 15f;
float localPositionPanY = 0; instance_btnPan.transform.localPosition = new Vector3(localPositionPanX, 145, 0);
float localPositionPanY_ = instance_btnPan.transform.localPosition.y + (localPositionPanY - instance_btnPan.transform.localPosition.y) * 0.2f;
instance_btnPan.height += (int)(((float)height - (float)instance_btnPan.height) * 0.2f);
instance_btnPan.transform.localPosition = new Vector3(localPositionPanX, localPositionPanY_, 0);
instance_lab.transform.localPosition = new Vector3(Screen.width/2-315, -Screen.height / 2+90, 0); instance_lab.transform.localPosition = new Vector3(Screen.width/2-315, -Screen.height / 2+90, 0);
int j = 0;
for (int i = 0; i < HashedButtons.Count; i++) for (int i = 0; i < HashedButtons.Count; i++)
{ {
if (HashedButtons[i].gameObject != null) if (HashedButtons[i].gameObject != null)
{ {
HashedButtons[i].gameObject.transform.localPosition += (new Vector3(0, height / 2 - 142 - i * 50, 0) - HashedButtons[i].gameObject.transform.localPosition) * Program.deltaTime * 10f; if (HashedButtons[i].dying)
{
HashedButtons[i].gameObject.transform.localPosition += (new Vector3(0, -120, 0) - HashedButtons[i].gameObject.transform.localPosition) * Program.deltaTime * 20f;
if (Math.Abs(HashedButtons[i].gameObject.transform.localPosition.y - -120) < 1)
HashedButtons[i].dead = true;
}
else
{
HashedButtons[i].gameObject.transform.localPosition += (new Vector3(0, -145 - j * 50, 0) - HashedButtons[i].gameObject.transform.localPosition) * Program.deltaTime * 10f;
j++;
}
} }
else
HashedButtons[i].dead = true;
}
for (int i = HashedButtons.Count - 1; i >= 0; i--)
{
if (HashedButtons[i].dead)
HashedButtons.RemoveAt(i);
} }
float height = 132 + 50 * j;
if (j == 0)
{
height = 116;
}
instance_btnPan.height += (int)(((float)height - (float)instance_btnPan.height) * 0.2f);
if (Program.TimePassed() - lastTickTime > 1000) if (Program.TimePassed() - lastTickTime > 1000)
{ {
lastTickTime = Program.TimePassed(); lastTickTime = Program.TimePassed();
...@@ -171,9 +189,10 @@ public class gameInfo : MonoBehaviour ...@@ -171,9 +189,10 @@ public class gameInfo : MonoBehaviour
} }
hashedButton.gameObject.transform.SetParent(instance_btnPan.transform,false); hashedButton.gameObject.transform.SetParent(instance_btnPan.transform,false);
hashedButton.gameObject.transform.localScale = Vector3.zero; hashedButton.gameObject.transform.localScale = Vector3.zero;
hashedButton.gameObject.transform.localPosition= Vector3.zero; hashedButton.gameObject.transform.localPosition= new Vector3(0, -120, 0);
hashedButton.gameObject.transform.localEulerAngles = Vector3.zero; hashedButton.gameObject.transform.localEulerAngles = Vector3.zero;
iTween.ScaleTo(hashedButton.gameObject, new Vector3(0.9f, 0.9f, 0.9f), 0.3f); iTween.ScaleTo(hashedButton.gameObject, new Vector3(0.9f, 0.9f, 0.9f), 0.3f);
hashedButton.dying = false;
HashedButtons.Add(hashedButton); HashedButtons.Add(hashedButton);
refreshLine(); refreshLine();
} }
...@@ -222,9 +241,9 @@ public class gameInfo : MonoBehaviour ...@@ -222,9 +241,9 @@ public class gameInfo : MonoBehaviour
{ {
if (remove.gameObject != null) if (remove.gameObject != null)
{ {
Program.I().destroy(remove.gameObject, 0.6f, true); Program.I().destroy(remove.gameObject, 0.3f, true);
} }
HashedButtons.Remove(remove); remove.dying = true;
} }
refreshLine(); refreshLine();
} }
...@@ -242,16 +261,24 @@ public class gameInfo : MonoBehaviour ...@@ -242,16 +261,24 @@ public class gameInfo : MonoBehaviour
{ {
if (HashedButtons[i].gameObject != null) if (HashedButtons[i].gameObject != null)
{ {
Program.I().destroy(HashedButtons[i].gameObject, 0.6f, true); Program.I().destroy(HashedButtons[i].gameObject, 0.3f, true);
} }
HashedButtons[i].dying = true;
} }
HashedButtons.Clear();
refreshLine(); refreshLine();
} }
void refreshLine() void refreshLine()
{ {
line.SetActive(HashedButtons.Count > 0); int j = 0;
for (int i = 0; i < HashedButtons.Count; i++)
{
if (!HashedButtons[i].dying)
{
j++;
}
}
line.SetActive(j > 0);
} }
int[] time = new int[2]; int[] time = new int[2];
......
...@@ -118,7 +118,7 @@ GameObject: ...@@ -118,7 +118,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 407516} - component: {fileID: 407516}
- component: {fileID: 11495680} - component: {fileID: 11495680}
m_Layer: 10 m_Layer: 18
m_Name: new_gameInfoRemaster m_Name: new_gameInfoRemaster
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
...@@ -305,7 +305,7 @@ Transform: ...@@ -305,7 +305,7 @@ Transform:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 139962} m_GameObject: {fileID: 139962}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
...@@ -321,7 +321,7 @@ Transform: ...@@ -321,7 +321,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 179438} m_GameObject: {fileID: 179438}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -65, y: 20, z: 0} m_LocalPosition: {x: -65, y: -25, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 481814} - {fileID: 481814}
...@@ -363,7 +363,7 @@ Transform: ...@@ -363,7 +363,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 114238} m_GameObject: {fileID: 114238}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -65, y: -44, z: 0} m_LocalPosition: {x: -65, y: -89, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 400434} - {fileID: 400434}
...@@ -379,7 +379,7 @@ Transform: ...@@ -379,7 +379,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 171338} m_GameObject: {fileID: 171338}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -65, z: 0} m_LocalPosition: {x: 0, y: -110, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 498562} m_Father: {fileID: 498562}
...@@ -418,7 +418,7 @@ Transform: ...@@ -418,7 +418,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 147310} m_GameObject: {fileID: 147310}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -65, y: -12, z: 0} m_LocalPosition: {x: -65, y: -57, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 451638} - {fileID: 451638}
...@@ -499,7 +499,7 @@ Transform: ...@@ -499,7 +499,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 104964} m_GameObject: {fileID: 104964}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 84, z: 0} m_LocalPosition: {x: 0, y: 129, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 411346} - {fileID: 411346}
...@@ -629,7 +629,7 @@ MonoBehaviour: ...@@ -629,7 +629,7 @@ MonoBehaviour:
checkSprite: {fileID: 0} checkSprite: {fileID: 0}
checkAnimation: {fileID: 0} checkAnimation: {fileID: 0}
eventReceiver: {fileID: 0} eventReceiver: {fileID: 0}
functionName: OnActivate functionName:
startsChecked: 0 startsChecked: 0
--- !u!114 &11401798 --- !u!114 &11401798
MonoBehaviour: MonoBehaviour:
...@@ -802,7 +802,7 @@ MonoBehaviour: ...@@ -802,7 +802,7 @@ MonoBehaviour:
checkSprite: {fileID: 0} checkSprite: {fileID: 0}
checkAnimation: {fileID: 0} checkAnimation: {fileID: 0}
eventReceiver: {fileID: 0} eventReceiver: {fileID: 0}
functionName: OnActivate functionName:
startsChecked: 0 startsChecked: 0
--- !u!114 &11418144 --- !u!114 &11418144
MonoBehaviour: MonoBehaviour:
...@@ -1045,7 +1045,7 @@ MonoBehaviour: ...@@ -1045,7 +1045,7 @@ MonoBehaviour:
checkSprite: {fileID: 0} checkSprite: {fileID: 0}
checkAnimation: {fileID: 0} checkAnimation: {fileID: 0}
eventReceiver: {fileID: 0} eventReceiver: {fileID: 0}
functionName: OnActivate functionName:
startsChecked: 0 startsChecked: 0
--- !u!114 &11431158 --- !u!114 &11431158
MonoBehaviour: MonoBehaviour:
...@@ -1424,7 +1424,7 @@ MonoBehaviour: ...@@ -1424,7 +1424,7 @@ MonoBehaviour:
absolute: 0 absolute: 0
updateAnchors: 1 updateAnchors: 1
mColor: {r: 1, g: 1, b: 1, a: 1} mColor: {r: 1, g: 1, b: 1, a: 1}
mPivot: 4 mPivot: 1
mWidth: 144 mWidth: 144
mHeight: 90 mHeight: 90
mDepth: 0 mDepth: 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