void CallGameUpdateZhunXingZuoBiao(Point pointVal) { //通知游戏更新准星坐标信息. //ScreenLog.Log("crossPos " + pointVal); byte indexVal = IndexMousePoint; if (indexVal % JiGuangLQ != 0) { return; } //错位处理玩家准星,可能是因为摄像头图像采集延迟. //或激光器延时或串口通信延时导致. if (indexVal == 0) { indexVal = (byte)(MaxMousePointNum - 1); } else { indexVal = (byte)((indexVal / JiGuangLQ) - 1); } //ScreenLog.Log(indexVal+" <- indexVal ********** IndexMousePoint -> " + IndexMousePoint); XKPlayerCrossCtrl playerCross = XKPlayerCrossCtrl.GetInstance(indexVal); if (playerCross != null) { playerCross.UpdateZhunXingZuoBiao(pointVal); } }
// Use this for initialization void Awake() { switch (PlayerIndex) { case 0: _InstanceP1 = this; break; case 1: _InstanceP2 = this; break; case 2: _InstanceP3 = this; break; case 3: _InstanceP4 = this; break; } CrossRtTr = GetComponent <RectTransform>(); if (CrossRtTr == null) { CrossTr = transform; } }
void InitJiaoZhunZuoBiao() { if (JiaoZhunCrossImg == null || JiaoZhunCrossImg.enabled) { return; } Debug.Log("InitJiaoZhunZuoBiao!"); // ZhunXingZB.Visible = false; // ZhunXingP1.Visible = false; XKPlayerCrossCtrl.SetAllCrossActive(false); IndexCrossJZ = 0; ChangeJiaoZhunPic(); JiaoZhunCrossImg.enabled = true; if (CSampleGrabberCB.GetInstance() != null) { CSampleGrabberCB.GetInstance().InitJiaoZhunZuoBiao(); } }
public void ChangeJiaoZhunPic() { if (!JiaoZhunCrossImg.enabled) { return; } switch (IndexCrossJZ) { case 0: case 1: case 2: case 3: JiaoZhunCrossImg.sprite = JiaoZhunCross[IndexCrossJZ]; break; default: IndexCrossJZ = 0; JiaoZhunCrossImg.enabled = false; XKPlayerCrossCtrl.SetAllCrossActive(true); break; } }
public static XKPlayerCrossCtrl GetInstance(byte indexPlayer) { XKPlayerCrossCtrl playerCross = null; switch (indexPlayer) { case 0: playerCross = _InstanceP1; break; case 1: playerCross = _InstanceP2; break; case 2: playerCross = _InstanceP3; break; case 3: playerCross = _InstanceP4; break; } return(playerCross); }