Commit 8f59239f authored by lijin's avatar lijin

性能优化

parent e506bc57
......@@ -67,7 +67,7 @@ public class GameMgr : MonoBehaviour
#endregion
#region 点击事件逻辑
public static readonly Vector2 gunSize = new Vector2(10, 5);
public static readonly Vector2 gunSize = new Vector2(50, 2);
private float time = 0;
private Vector2 pos = Vector2.zero;
private int isLongPress = -1;//-1无逻辑,0按下,1响应点击,2响应长按
......
......@@ -72,14 +72,15 @@ public class MainData : MonoBehaviour
//点击逻辑,v图内像素坐标,b是否跳过当前选组ID判断,返回bool以判断散弹枪是否终止
public bool OnClickFun(Vector2 v, bool b = false)
{
int Index = (int)(v.x + v.y * json.width);
//x越界
if (v.x < 0 || v.x >= json.width) { return false; }
//y越界
if (v.y < 0 || v.y >= json.height) { return false; }
//涂过了,或点击到线
if (png.GetPixel((int)v.x, (int)v.y) != Color.white) { return false; }
if (c_png[Index] != Color.white) { return false; }
Color c = map.GetPixel((int)v.x, (int)v.y);//点击的点阵数据:rgba,rg为房间ID,ba为组ID
Color c = c_map[Index];//点击的点阵数据:rgba,rg为房间ID,ba为组ID
int roomId = ResJsonData.ColorToV(c).x;
RoomDatas rd = json.roomDatas[roomId];
//涂过了
......@@ -106,14 +107,15 @@ public class MainData : MonoBehaviour
//长按逻辑,v图内像素坐标
public void OnLongPressPos(Vector2 v)
{
int Index = (int)(v.x + v.y * json.width);
//x越界
if (v.x < 0 || v.x >= json.width) { return; }
//y越界
if (v.y < 0 || v.y >= json.height) { return; }
//涂过了,或点击到线
if (png.GetPixel((int)v.x, (int)v.y) != Color.white) { return; }
if (c_png[Index] != Color.white) { return ; }
Color c = map.GetPixel((int)v.x, (int)v.y);//点击的点阵数据:rgba,rg为房间ID,ba为组ID
Color c = c_map[Index];//点击的点阵数据:rgba,rg为房间ID,ba为组ID
int groupId = ResJsonData.ColorToV(c).y;
ChooseGroup(groupId);
}
......
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