Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        //网络监听
        NetManager.AddEventListener(NetManager.NetEvent.Close, OnConnectClose);
        NetManager.AddMsgListener("MsgKick", OnMsgKick);
        //初始化
        PanelManager.Init();
        BattleManager.Init();
        //打开登陆面板
        PanelManager.Open <LoginPanel>();

        /*用于单机测试
         * GameMain.id = "cat";
         * TankInfo tankInfo = new TankInfo();
         * tankInfo.camp = 1;
         * tankInfo.id = GameMain.id;
         * tankInfo.hp = 30;
         * tankInfo.x = 262;
         * tankInfo.y = -8;
         * tankInfo.z = 342;
         * BattleManager.GenerateTank(tankInfo);
         * PanelManager.Open<BattlePanel>();
         * PanelManager.Open<AimPanel>();
         *
         * TankInfo tankInfo2 = new TankInfo();
         * tankInfo2.camp = 2;
         * tankInfo2.id = "dog";
         * tankInfo2.hp = 100;
         * tankInfo2.z = 30;
         * tankInfo2.y = 5;
         * tankInfo2.ey = 130;
         * BattleManager.GenerateTank(tankInfo2);
         */
    }
Esempio n. 2
0
    //显示
    public override void OnShow(params object[] args)
    {
        //寻找组件
        idInput    = skin.transform.Find("IdInput").GetComponent <InputField>();
        pwInput    = skin.transform.Find("PwInput").GetComponent <InputField>();
        loginBtn   = skin.transform.Find("LoginBtn").GetComponent <Button>();
        regBtn     = skin.transform.Find("RegisterBtn").GetComponent <Button>();
        aboutUsBtn = skin.transform.Find("AboutUsBtn").GetComponent <Button>();
        //监听
        loginBtn.onClick.AddListener(OnLoginClick);
        regBtn.onClick.AddListener(OnRegClick);
        aboutUsBtn.onClick.AddListener(OnAboutUsClick);
        loginBtn.onClick.AddListener(Audio.ButtonClick);
        regBtn.onClick.AddListener(Audio.ButtonClick);
        aboutUsBtn.onClick.AddListener(Audio.ButtonClick);
        //网络协议监听
        NetManager.AddMsgListener("MsgLogin", OnMsgLogin);
        //网络事件监听
        NetManager.AddEventListener(NetManager.NetEvent.ConnectSucc, OnConnectSucc);
        NetManager.AddEventListener(NetManager.NetEvent.ConnectFail, OnConnectFail);
        //连接服务器
        NetManager.Connect("127.0.0.1", 8888);

        Audio.PlayLoop(Audio.bgLoginPanel);
    }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     //事件监听
     NetManager.AddEventListener(NetManager.NetEvent.ConnectSucc, OnConnectSucc);
     NetManager.AddEventListener(NetManager.NetEvent.ConnectFail, OnConnectFail);
     NetManager.AddEventListener(NetManager.NetEvent.Close, OnConnectClose);
     //消息监听
     NetManager.AddMsgListener("MsgChat", OnMsgChat);
     NetManager.AddMsgListener("MsgSyn", OnMsgSyn);
 }
Esempio n. 4
0
    //开始
    void Start()
    {
        NetManager.AddEventListener(NetManager.NetEvent.ConnectSucc, OnConnectSucc);
        NetManager.AddEventListener(NetManager.NetEvent.ConnectFail, OnConnectFail);
        NetManager.AddEventListener(NetManager.NetEvent.Close, OnConnectClose);

        NetManager.AddMsgListener("MsgRegister", OnMsgRegister);
        NetManager.AddMsgListener("MsgLogin", OnMsgLogin);
        NetManager.AddMsgListener("MsgKick", OnMsgKick);
    }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     //网络监听
     NetManager.AddEventListener(NetManager.NetEvent.Close, OnConnectClose);
     NetManager.AddMsgListener("MsgKick", OnMsgKick);
     //初始化
     PanelManager.Init();
     BattleManager.Init();
     //打开登陆面板
     PanelManager.Open <LoginPanel>();
 }
Esempio n. 6
0
	// Use this for initialization
	void Start () {
		//网络监听
		NetManager.AddEventListener(NetManager.NetEvent.Close, OnConnectClose);
		NetManager.AddMsgListener("MsgKick", OnMsgKick);
		//初始化
		PanelManager.Init();
        Audio.Init();
        Pai.Init();
        Gamedata.Init();
		//打开登陆面板
		PanelManager.Open<LoginPanel>();
        Debug.Log("start");
	}
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        //网络监听
        NetManager.AddEventListener(NetManager.NetEvent.Close, OnConnectClose);
        NetManager.AddMsgListener("MsgKick", OnMsgKick);
        NetManager.AddMsgListener("MsgAddFriend", OnMsgAddFriend);
        NetManager.AddMsgListener("MsgAcceptAddFriend", OnMsgAcceptAddFriend);
        NetManager.AddMsgListener("MsgDeleteFriend", OnMsgDeleteFriend);

        PanelManager.Init();

        //打开登陆面板
        SceneManager.LoadSceneAsync("LoginMenu");

        //打开登陆面板
        PanelManager.Open <LoginPanel>();
    }
Esempio n. 8
0
 /// <summary>
 /// 连接服务
 /// </summary>
 /// <param name="ip"></param>
 /// <param name="port"></param>
 public static void Start(string ip, int port)
 {
     //网络协议监听
     NetManager.AddMsgListener("MsgEnter", OnMsgEnter);
     //room
     NetManager.AddMsgListener("MsgGetRoomList", NetRoomHandler.OnMsgGetRoomList);
     NetManager.AddMsgListener("MsgCreateRoom", NetRoomHandler.OnMsgCreateRoom);
     NetManager.AddMsgListener("MsgEnterRoom", NetRoomHandler.OnMsgEnterRoom);
     NetManager.AddMsgListener("MsgGetRoomInfo", NetRoomHandler.OnMsgGetRoomInfo);
     NetManager.AddMsgListener("MsgLeaveRoom", NetRoomHandler.OnMsgLeaveRoom);
     NetManager.AddMsgListener("MsgLeaveGame", NetRoomHandler.OnMsgLeaveGame);
     //网络事件监听
     NetManager.AddEventListener(NetManager.NetEvent.ConnectSucc, NetEventHandler.OnConnectSucc);
     NetManager.AddEventListener(NetManager.NetEvent.ConnectFail, NetEventHandler.OnConnectFail);
     NetManager.AddEventListener(NetManager.NetEvent.Close, NetEventHandler.OnClose);
     NetManager.Connect(ip, port);
 }
Esempio n. 9
0
 // Use this for initialization
 void Start()
 {
     //初始化人物预设
     pre = ResManager.LoadPrefab("Yuka_mecanim 1");
     //初始化物品配置
     ItemsConfigManager.init();
     //网络监听
     NetManager.AddEventListener(NetManager.NetEvent.Close, OnConnectClose);
     NetManager.AddMsgListener("MsgKick", OnMsgKick);
     NetManager.AddMsgListener("MsgSyncPlayer", OnMsgSyncPlayer);
     NetManager.AddMsgListener("MsgOutGame", OnMsgOutGame);
     NetManager.AddMsgListener("MsgAcAttack", OnMsgAcAttack);
     //初始化
     PanelManager.Init();
     //打开登陆面板
     PanelManager.Open <LoginPanel>();
 }
Esempio n. 10
0
 //显示
 public override void OnShow(params object[] args)
 {
     //寻找组件
     idInput  = skin.transform.Find("IdInput").GetComponent <InputField>();
     pwInput  = skin.transform.Find("PwInput").GetComponent <InputField>();
     loginBtn = skin.transform.Find("LoginBtn").GetComponent <Button>();
     regBtn   = skin.transform.Find("RegisterBtn").GetComponent <Button>();
     bgImage  = skin.transform.Find("BgImage").GetComponent <Image>();
     //监听
     loginBtn.onClick.AddListener(OnLoginClick);
     regBtn.onClick.AddListener(OnRegClick);
     //网络协议监听
     NetManager.AddMsgListener("MsgLogin", OnMsgLogin);
     //网络事件监听
     NetManager.AddEventListener(NetManager.NetEvent.ConnectSucc, OnConnectSucc);
     NetManager.AddEventListener(NetManager.NetEvent.ConnectFail, OnConnectFail);
     //连接服务器
     NetManager.Connect(ip, port);
     //记录时间
     startTime = Time.time;
 }