public void handle_setCurrentPlayer(int iCurrentPlayer, int iUserAction, byte cbActionCard = 0, bool bForceAction = false) { #if true if (iCurrentPlayer < 0 || iCurrentPlayer > MAX_PLAYER) { Debug.Assert(false, "setCurrentPlayer assert failed"); return; } defaultPlayerActionState(); m_iCurrentUser = iCurrentPlayer; //cocos2d::Node* pRootNode = WidgetFun::getChildWidget(this, "TimeNode"); HNMJPlayer pPlyer = getPlayerByChairID(m_iCurrentUser); if (pPlyer == null) { return; } if (iUserAction == HNMJLogic_Defines.WIK_NULL) { //WidgetFun::setVisible(pRootNode, utility::toString("TimePoint", pPlyer.getIdex()), true); } Loom.QueueOnMainThread(() => { hnManager.setCurrentPlayer(m_iCurrentUser); }); #endif }
//用户托管 public void OnSubTrustee(byte[] pBuffer, ushort wDataSize) { var typeValue = typeof(CMD_S_Trustee); if (wDataSize != Marshal.SizeOf(typeValue)) { return; } //消息处理 CMD_S_Trustee pTrustee = (CMD_S_Trustee)StructConverterByteArray.BytesToStruct(pBuffer, typeValue); // UI Log HNMJPlayer pPlyer = getPlayerByChairID(pTrustee.wChairID); if (pPlyer == null) { return; } String strNickName = pPlyer.GetNickName(); String[] strName = strNickName.Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries); if (strName.Length > 0) { Loom.QueueOnMainThread(() => { ChatSystem.GetInstance.ShowChatText("通知", strName[0] + " 离开了房间!"); }); } Loom.QueueOnMainThread(() => { PlayerBase player = GameObjectsManager.GetInstance().GetPlayerByChairID(pTrustee.wChairID); if (player != null) { Debug.LogWarning("------------- " + player.ChairID); GameObjectsManager.GetInstance().RemovePlayerByChairID(player.TeamType, (byte)player.ChairID); //离开房间移除玩家 } }); }
public virtual bool init() { //mChen add, clear UI info, fix UI bug after 解散房间 Loom.QueueOnMainThread(() => { hnManager.ResetPlayersUIInfo(); hnManager.DefaultState(); }); initPrivate(); initButton(); initNet(); initTouch(); initLanguageAndEmoji(); //add Language And Emoji for (int i = 0; i < MAX_PLAYER; i++) { m_pPlayer[i] = new HNMJPlayer(i, hnManager); } m_pLocal = m_pPlayer[0]; return(true); }