void LocalFire(GameObject target) { if (BelongRole == null || BelongRole.m_nTotalCoin < m_nBulletCost) { LocalFireFail(); return; } UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CCMsg_FISHING_CM_APPLYFIRE); msg.Add(GameMain.hall_.GetPlayerId()); msg.Add(transform.eulerAngles.z); msg.Add((byte)m_Data.m_szBulletPoint.Length); msg.Add(++m_nBulletId); HallMain.SendMsgToRoomSer(msg); OnFire(target, m_nBulletId); if (m_FireSound != null) { m_FireSound.volume = AudioManager.Instance.SoundVolume; m_FireSound.loop = false; m_FireSound.Play(); } BelongRole.UpdateInfoUI(BelongRole.m_nTotalCoin - m_nBulletCost); }
void OnClickQuickMatch() { CustomAudio.GetInstance().PlayCustomAudio(1002); CCustomDialog.OpenCustomWaitUI("正在进入..."); UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_APPLYQUITSTARTGAME); msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType()); msg.Add(GameMain.hall_.CurRoomIndex); msg.Add(GameMain.hall_.GetPlayerId()); HallMain.SendMsgToRoomSer(msg); }
void OnClickDeskReady() { CustomAudio.GetInstance().PlayCustomAudio(1002); TableTfm.Find("bottom/Button_Ready").GetComponent <Button>().interactable = false; UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_APPLYREADY); msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType()); msg.Add(GameMain.hall_.GetPlayerId()); HallMain.SendMsgToRoomSer(msg); }
void OnHit(GameObject obj, Vector3 hitpoint, Canvas cv) { Fishing_Fish fish = obj.GetComponent <Fishing_Fish>(); if (fish == null) { return; } Destroy(gameObject); GameObject prefab = (GameObject)OwnerCannon.BelongRole.GameBase.FishingAssetBundle.LoadAsset(m_szNet); Vector3 pos = GameFunction.WorldToLocalPointInRectangle(hitpoint, Camera.main, cv, cv.worldCamera); Transform root = cv.transform.Find("Root"); GameObject explosion = (GameObject)Instantiate(prefab, pos, Quaternion.identity); explosion.transform.SetParent(root, false); OwnerCannon.BelongRole.GameBase.m_AddItems.Add(explosion); prefab = (GameObject)OwnerCannon.BelongRole.GameBase.FishingAssetBundle.LoadAsset("FishHit"); GameObject bubble = (GameObject)Instantiate(prefab, pos, Quaternion.identity); bubble.transform.SetParent(root, false); OwnerCannon.BelongRole.GameBase.m_AddItems.Add(bubble); GameMain.WaitForCall(1f, () => { OwnerCannon.BelongRole.GameBase.m_AddItems.Remove(explosion); Destroy(explosion); OwnerCannon.BelongRole.GameBase.m_AddItems.Remove(bubble); Destroy(bubble); }); bool bLocal = m_Id != 0; fish.OnHit(bLocal); if (bLocal)//local player send { UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CCMsg_FISHING_CM_FIRERESULT); msg.Add(GameMain.hall_.GetPlayerId()); msg.Add(fish.m_nOnlyId); msg.Add(m_Id); HallMain.SendMsgToRoomSer(msg); } }
void OnClickSit(ushort desk, sbyte sit) { CustomAudio.GetInstance().PlayCustomAudio(1002); DebugLog.Log("Click desk:" + desk + " sit:" + sit); CCustomDialog.OpenCustomWaitUI("正在进入..."); UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_APPLYENTERROOMANDSIT); msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType()); msg.Add(GameMain.hall_.GetPlayerId()); msg.Add(desk); msg.Add(sit); HallMain.SendMsgToRoomSer(msg); }
public void SetUIAsLast() { if (m_nBystanderRoom > 0) { UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_APPLYTOBEONLOOKER); msg.Add(GameMain.hall_.GetPlayerId()); msg.Add((uint)(GameKind_Enum.GameKind_CzMahjong)); msg.Add(m_nBystanderRoom); HallMain.SendMsgToRoomSer(msg); } else { RoomTfm.SetAsLastSibling(); if (TableTfm) { TableTfm.SetAsLastSibling(); TableTfm.Find("bottom/Button_Ready").gameObject.SetActive(true); } } }
public void OnClickLevel(byte nAdd) { if (m_Cannon == null) { return; } UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CCMsg_FISHING_CM_CHANGECANNONLEVEL); msg.Add(GameMain.hall_.GetPlayerId()); msg.Add(nAdd); HallMain.SendMsgToRoomSer(msg); if (nAdd > 0) { m_LvAddBtn.interactable = false; } else { m_LvSubBtn.interactable = false; } }
public void OnClickReturn(int index)//0:离开房间 1:继续 2:分享 3:退出 { CustomAudio.GetInstance().PlayCustomAudio(1002); if (index == 0) { CCustomDialog.OpenCustomWaitUI("正在离开..."); UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_APPLYLEAVEROOMANDSIT); msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType()); msg.Add(GameMain.hall_.GetPlayerId()); HallMain.SendMsgToRoomSer(msg); } else if (index == 1) { GameMain.hall_.GameBaseObj.OnDisconnect(false); OnClickSit(0, -1); } else if (index == 3) { UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_PLAYERLEAVEROOMSER); msg.Add(GameMain.hall_.GetPlayerId()); HallMain.SendMsgToRoomSer(msg); } }
public void ChangeLockFish(Fishing_Fish fish) { if (fish == null) { return; } if (LockFish != null) { LockFish.Unlock(m_nIndex); } LockFish = fish; LockFish.Lock(m_nIndex); if (IsLocal()) { UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CCMsg_FISHING_CM_TRACECHANGETARGET); msg.Add(GameMain.hall_.GetPlayerId()); msg.Add(LockFish.m_nOnlyId); HallMain.SendMsgToRoomSer(msg); } }
void CheckDeskInView(bool send) { if (m_bUpdateDesk) { return; } float pos = (1f - m_Scroll.verticalScrollbar.value) * (1f - m_fScreenHRatio); float posEnd = pos + m_fScreenHRatio; uint begin = (uint)(pos / m_fDeskHRatio); begin = begin * m_nDeskNumPerRow + 1; uint end = (uint)(posEnd / m_fDeskHRatio); end = (end + 1) * m_nDeskNumPerRow; if (end > m_nDeskNum) { end = m_nDeskNum; } if (send) { DebugLog.LogWarning("Inview:" + begin + "-" + end); ushort start = 0; ushort stop = 0; for (uint i = begin; i <= end; i++) { RoomDeskInfo di = m_dictIndexDesks[i]; if (!di.m_bInited) { if (start == 0) { start = (ushort)i; } } else if (start != 0) { stop = (ushort)(i - 1); } } if (stop == 0) { stop = (ushort)end; } if (start != 0) { UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_UPDATEBEFOREHANDROOMINFO); msg.Add((byte)GameMain.hall_.GameBaseObj.GetGameType()); msg.Add(GameMain.hall_.CurRoomIndex); msg.Add(start); msg.Add((ushort)(stop - start + 1)); HallMain.SendMsgToRoomSer(msg); DebugLog.Log("Request desk info:" + start + "-" + stop + "level:" + GameMain.hall_.CurRoomIndex); } } else { foreach (var di in m_dictIndexDesks) { di.Value.Show(di.Key >= begin && di.Key <= end); } } }