Exemple #1
0
 void MainMessageIn(string msg, int delay, ArcaletGame game)
 {
     try
     {
         Debug.Log("MainMessageIn, msg = " + msg);
     }
     catch (Exception e) { Debug.LogWarning("MainMessageIn Exception:\r\n" + e.ToString()); }
 }
 void CB_Login(int code, ArcaletGame game)
 {
     if (code == 0)
     {
     }
     else
     {
     }
 }
 void MainMessageIn(string msg, int delay, ArcaletGame game)
 {
     try
     {
         Console.WriteLine("MainMessageIn: " + msg);
         string[] cmds = msg.Split(':');
         switch (cmds[0])
         {
         }
     }
     catch (Exception e) { Console.WriteLine(e.ToString()); }
 }
Exemple #4
0
 void myComplete(int code, ArcaletGame game)
 {
     if (code == 0)
     {
         Debug.Log("ok");
         ag.Send("come");
         Application.LoadLevel("test");
     }
     else
     {
         Debug.Log(code.ToString());
     }
 }
Exemple #5
0
    void myComplete(int code,ArcaletGame game)
    {
        if(code==0)
        {
            Debug.Log("ok");
            ag.Send("come");
            Application.LoadLevel("test");
        }
        else
        {
            Debug.Log(code.ToString());

        }
    }
Exemple #6
0
 //callback function
 void CB_ArcaletLaunch(int code, ArcaletGame game)
 {
     Debug.Log("CB_ArcaletLaunch");
     if (code == 0)
     {
         Debug.Log("ArcaletLaunch Successed");
         SceneManager.LoadScene("lobby");
         LoginCheck();
     }
     else
     {
         Debug.Log("ArcaletLaunch Failed code = " + code);
         /* Login Failed, regist this user automatically */
         Regist(m_username, m_password, m_email);
     }
 }
        void PrivateMessageIn(string msg, int delay, ArcaletGame game)
        {
            try
            {
                Console.WriteLine("PrivateMessageIn: " + msg);
                string[] cmds = msg.Split(':');
                switch (cmds[0])
                {
                case "dp_new": setdpPoid(int.Parse(cmds[1])); break;

                case "dp_room": dpRoom(cmds[1]); break;
                    //    case "cancel": CancelMatchCheck(int.Parse(cmds[1])); break;
                }
            }
            catch (Exception) { }
        }
Exemple #8
0
    public void waitCall(string userId, string password)
    {
        Debug.Log("tessssssss");
        ag = new ArcaletGame(userId, password, gguid, sguid, gcert);
        //this.userid=userId;
        ag.onCompletion   = myComplete;
        ag.onStateChanged = stateChange;
        ag.onMessageIn    = myMessage;
#if UNITY_WEBPLAYER
        ag.WebLaunch();
#else
        ag.STALaunch();
#endif

        hadLaunched = true;
    }
Exemple #9
0
    public void waitCall(string userId,string password)
    {
        Debug.Log("tessssssss");
        ag=new ArcaletGame(userId,password,gguid,sguid,gcert);
        //this.userid=userId;
        ag.onCompletion=myComplete;
        ag.onStateChanged=stateChange;
        ag.onMessageIn=myMessage;
        #if UNITY_WEBPLAYER
        ag.WebLaunch();
        #else
        ag.STALaunch();
        #endif

        hadLaunched=true;
    }
Exemple #10
0
    void PrivateMessageIn(string msg, int delay, ArcaletGame game)
    {
        try {
            Debug.Log("@ PrivaMsg>> " + msg);
            string[] cmds = msg.Split(':');
            switch (cmds[0])
            {
            case "dp_new": GetPlayerInfos(cmds[1]); break;

            case "dp_room": DP_Room(cmds[1]); break;

            case "dp_rematch": ReMatch(cmds[1]); break;

            case "bb_match_data": UpdateMatchData(cmds[1]); break;
                //	case "dp_update": OXGame.UpdatePlayerInfos(cmds[1]); break;
            }
        }
        catch (Exception e) { Debug.LogWarning("PrivateMessageIn Exception:\r\n" + e.ToString()); }
    }
Exemple #11
0
 //login arcalet server
 internal void ArcaletLaunch(string username, string password, string email)
 {
     Debug.Log("ArcaletLaunch");
     if (ag != null)
     {
         ag.Dispose();
     }
     Debug.Log("ArcaletLaunch1");
     m_username = username;
     m_password = password;
     m_email    = email;
     ag         = new ArcaletGame(username, password, gguid, sguid, certificate);
     Debug.Log("ArcaletLaunch 2");
     //	ag = new ArcaletGame("bbhappy010", "12345678", gguid, sguid, certificate );
     ag.onMessageIn        += MainMessageIn;
     ag.onPrivateMessageIn += PrivateMessageIn;
     ag.onCompletion       += CB_ArcaletLaunch;
     ag.Launch();
 }
Exemple #12
0
    void OnGameMessageIn(string msg, int delay, ArcaletGame game)
    {
        string[] s = msg.Split(':');
        if (s[0] == "Strike")         // 进攻命令
        // 讯息格式: "Strike:poid/userid/unitid/posx/posy/posz"
        {
            string[] p         = s[1].Split('/');
            int      newPoid   = int.Parse(p[0]);           // 新玩家的私人场景
            string   newUserid = p[1];                      // 新玩家的userid
            int      unitid    = int.Parse(p[2]);
            float    posx      = float.Parse(p[3]);
            float    posy      = float.Parse(p[4]);
            float    posz      = float.Parse(p[5]);


//			if (newPoid!=ag.poid) {			// 新进的玩家不是本地玩家
//				Debug.Log(p[1]+" is coming!!!");
//
//				// 产生一个远程玩家的太空战机
//				Vector3 position = new Vector3(0.0f,-3.219612f,0.0f);
//				GameObject newPlayer=(GameObject)Instantiate(remotePlayerPrefab, position,Quaternion.identity);
//
//				// 把这个玩家数据数据记起来
//				AddPlayer(newPoid,newUserid,false,newPlayer);
//
//				// 把本地玩家的数据告诉新进玩家(用新进玩家的私人场景传讯)
//				if (isMaster) {
//					// 如果本地玩家是master,格式是 "player:M/poid/userid"
//					ag.PrivacySend(
//						"player:M/"+ag.poid.ToString()+"/"+this.userid,newPoid);
//				}
//				else {
//					// 如果本地玩家不master,格式是 "player:G/poid/userid"
//					ag.PrivacySend(
//						"player:G/"+ag.poid.ToString()+"/"+this.userid,newPoid);
//				}
//			}
//			else {
//				Debug.Log("I'm coming!");
//			}
        }
    }
Exemple #13
0
 void stateChange(int state, int code, ArcaletGame game)
 {
     //if(code==0)
     Debug.Log(state);
 }
Exemple #14
0
 void myMessage(string msg, int delay, ArcaletGame game)
 {
     Debug.Log(msg);
 }
        void CB_ArcaletLaunch(int code, ArcaletGame game)
        {
            if (code == 0)
            {
                for (int i = 0; i < 1 /*m_user.Count*/; i++)
                {
                    if (m_user[i].account == game.gameUserid)
                    {
                        Console.WriteLine("OK");
                        m_user[i].userStatus      = new Label();
                        m_user[i].userStatus.Text = "Login Successfully";

                        m_user[i].userStatus.Location = new Point(150, 20 + (i + 1) * 30);
                        this.Controls.Add(m_user[i].userStatus);

                        m_user[i].matchButton          = new Button();
                        m_user[i].matchButton.Text     = "Match";
                        m_user[i].matchButton.Name     = game.gameUserid;
                        m_user[i].matchButton.Click   += new EventHandler(btMatch_Click);
                        m_user[i].matchButton.Location = new Point(300, 15 + (i + 1) * 30);
                        this.Controls.Add(m_user[i].matchButton);

                        //StartCoroutine("DPLinkTimer");
                        m_user[i].ag.SendOnClose("quit:" + m_user[i].ag.gameUserid + "/" + m_user[i].ag.poid);
                        m_user[i].ag.Send("new:" + m_user[i].ag.gameUserid + "/" + m_user[i].ag.poid);

                        m_user[i].matchinfo = new MatchInfo();
                        m_user[i].matchinfo.GenerateMatchCode();

                        m_user[i].upButton          = new Button();
                        m_user[i].upButton.Text     = "Up";
                        m_user[i].upButton.Name     = game.gameUserid;
                        m_user[i].upButton.Click   += new EventHandler(btUp_Click);
                        m_user[i].upButton.Location = new Point(450, 15 + (i + 1) * 30);
                        this.Controls.Add(m_user[i].upButton);

                        m_user[i].upButton          = new Button();
                        m_user[i].upButton.Text     = "Down";
                        m_user[i].upButton.Name     = game.gameUserid;
                        m_user[i].upButton.Click   += new EventHandler(btDown_Click);
                        m_user[i].upButton.Location = new Point(550, 15 + (i + 1) * 30);
                        this.Controls.Add(m_user[i].upButton);

                        m_user[i].upButton          = new Button();
                        m_user[i].upButton.Text     = "Left";
                        m_user[i].upButton.Name     = game.gameUserid;
                        m_user[i].upButton.Click   += new EventHandler(btLeft_Click);
                        m_user[i].upButton.Location = new Point(650, 15 + (i + 1) * 30);
                        this.Controls.Add(m_user[i].upButton);

                        m_user[i].upButton          = new Button();
                        m_user[i].upButton.Text     = "Right";
                        m_user[i].upButton.Name     = game.gameUserid;
                        m_user[i].upButton.Click   += new EventHandler(btRight_Click);
                        m_user[i].upButton.Location = new Point(750, 15 + (i + 1) * 30);
                        this.Controls.Add(m_user[i].upButton);

                        m_user[i].upButton          = new Button();
                        m_user[i].upButton.Text     = "Stop";
                        m_user[i].upButton.Name     = game.gameUserid;
                        m_user[i].upButton.Click   += new EventHandler(btStop_Click);
                        m_user[i].upButton.Location = new Point(850, 15 + (i + 1) * 30);
                        this.Controls.Add(m_user[i].upButton);

                        m_user[i].upButton          = new Button();
                        m_user[i].upButton.Text     = "Death";
                        m_user[i].upButton.Name     = game.gameUserid;
                        m_user[i].upButton.Click   += new EventHandler(btDeath_Click);
                        m_user[i].upButton.Location = new Point(950, 15 + (i + 1) * 30);
                        this.Controls.Add(m_user[i].upButton);

                        GetItemClass(i);
                    }
                }
            }
            else
            {
                Console.WriteLine("GG code = " + code);
            }
        }
Exemple #16
0
 void stateChange(int state,int code,ArcaletGame game)
 {
     //if(code==0)
         Debug.Log(state);
 }
Exemple #17
0
 void myMessage(string msg,int delay,ArcaletGame game)
 {
     Debug.Log(msg);
 }