示例#1
0
        internal SignInForm()
        {
            InitializeComponent();
            playerNameTextBox = sign_in_player_name_text_box;
            errorLabel        = sign_in_error_label;
            connectButton     = sign_in_connect_button;

            //Подписка на события клиента:
            PongClient client = GameFieldForm.client;

            client.OnConnect += OnConnect;
        }
示例#2
0
文件: EventUtils.cs 项目: JWWade/DOSE
 /**
  * This function sets the PongServer or PongClient script static reference
  * based on the role of this process.
  */
 public static void AnnounceRoleSelection(byte _ROLE_)
 {
     if (_ROLE_ == GeneralUtils.ROLE_SERVER)
     {
         m_pongServerScript = GameObject.Find("ScriptHub").GetComponent <PongServer>();
         GeneralUtils.m_pongServerScript   = m_pongServerScript;
         m_ballScript.ServerBallBehavior   = true;
         m_agentScript.ServerAgentBehavior = true;
         GameObject.Find("ScriptHub").AddComponent <StateDiagramGenerator>();
     }
     else if (_ROLE_ == GeneralUtils.ROLE_CLIENT)
     {
         m_pongClientScript = GameObject.Find("ScriptHub").GetComponent <PongClient>();
         GeneralUtils.m_pongClientScript   = m_pongClientScript;
         m_ballScript.ServerBallBehavior   = false;
         m_agentScript.ServerAgentBehavior = false;
     }
 }