Ejemplo n.º 1
0
    //显示
    public override void OnShow(params object[] args)
    {
        //寻找组件
        idText        = skin.transform.Find("InfoPanel/IdText").GetComponent <Text>();
        scoreText     = skin.transform.Find("InfoPanel/ScoreText").GetComponent <Text>();
        createButton  = skin.transform.Find("CtrlPanel/CreateButton").GetComponent <Button>();
        reflashButton = skin.transform.Find("CtrlPanel/ReflashButton").GetComponent <Button>();
        content       = skin.transform.Find("ListPanel/Scroll View/Viewport/Content");
        roomObj       = skin.transform.Find("Room").gameObject;
        //不激活房间
        roomObj.SetActive(false);
        //显示id
        idText.text = GameMain.id;
        //按钮事件
        createButton.onClick.AddListener(OnCreateClick);
        reflashButton.onClick.AddListener(OnReflashClick);
        //协议监听
        NetManager.AddMsgListener("MsgGetAchieve", OnMsgGetAchieve);
        NetManager.AddMsgListener("MsgGetRoomList", OnMsgGetRoomList);
        NetManager.AddMsgListener("MsgCreateRoom", OnMsgCreateRoom);
        NetManager.AddMsgListener("MsgEnterRoom", OnMsgEnterRoom);
        //发送查询
        MsgGetAchieve msgGetAchieve = new MsgGetAchieve();

        NetManager.Send(msgGetAchieve);
        MsgGetRoomList msgGetRoomList = new MsgGetRoomList();

        NetManager.Send(msgGetRoomList);
    }
Ejemplo n.º 2
0
    //收到成绩查询协议
    public void OnMsgGetAchieve(MsgBase msgBase)
    {
        MsgGetAchieve msg = (MsgGetAchieve)msgBase;

        scoreText.text = msg.win + "胜 " + msg.lost + "负";
        majorText.text = Gamedata.majors[msg.major];
        coinText.text  = msg.coin.ToString();
        coin           = msg.coin;
        major          = msg.major;
    }
Ejemplo n.º 3
0
	//查询战绩
	public static void MsgGetAchieve(ClientState c, MsgBase msgBase){
		MsgGetAchieve msg = (MsgGetAchieve)msgBase;
		Player player = c.player;
		if(player == null) return;

		msg.win = player.data.win;
		msg.lost = player.data.lost;

		player.Send(msg);
	}
Ejemplo n.º 4
0
    //显示
    public override void OnShow(params object[] args)
    {
        //寻找组件
        idText        = skin.transform.Find("InfoPanel/IdText").GetComponent <Text>();
        scoreText     = skin.transform.Find("InfoPanel/ScoreText").GetComponent <Text>();
        majorText     = skin.transform.Find("InfoPanel/CampText").GetComponent <Text>();
        coinText      = skin.transform.Find("InfoPanel/GoldText").GetComponent <Text>();
        createButton  = skin.transform.Find("CtrlPanel/CreateButton").GetComponent <Button>();
        reflashButton = skin.transform.Find("CtrlPanel/RefreshButton").GetComponent <Button>();
        chooseButton  = skin.transform.Find("CtrlPanel/ChooseBtn").GetComponent <Button>();
        pressMeButton = skin.transform.Find("CtrlPanel/PressMeBtn").GetComponent <Button>();
        content       = skin.transform.Find("ListPanel/Scroll View/Viewport/Content");
        roomObj       = skin.transform.Find("Room").gameObject;
        //不激活房间
        roomObj.SetActive(false);
        //显示id
        idText.text = GameMain.id;
        //按钮事件(chooseButton实际上是reflashButton)
        createButton.onClick.AddListener(OnCreateClick);
        reflashButton.onClick.AddListener(OnReflashClick);
        chooseButton.onClick.AddListener(OnChooseClick);
        pressMeButton.onClick.AddListener(OnPressMeClick);

        createButton.onClick.AddListener(Audio.ButtonClick);
        reflashButton.onClick.AddListener(Audio.ButtonClick);
        chooseButton.onClick.AddListener(Audio.ButtonClick);
        pressMeButton.onClick.AddListener(Audio.ButtonClick);
        //协议监听
        NetManager.AddMsgListener("MsgGetAchieve", OnMsgGetAchieve);
        NetManager.AddMsgListener("MsgGetRoomList", OnMsgGetRoomList);
        NetManager.AddMsgListener("MsgCreateRoom", OnMsgCreateRoom);
        NetManager.AddMsgListener("MsgEnterRoom", OnMsgEnterRoom);
        NetManager.AddMsgListener("MsgVisitShop", OnMsgVisitShop);
        //发送查询
        MsgGetAchieve msgGetAchieve = new MsgGetAchieve();

        NetManager.Send(msgGetAchieve);
        MsgGetRoomList msgGetRoomList = new MsgGetRoomList();

        NetManager.Send(msgGetRoomList);

        Audio.PlayLoop(Audio.bgRoomListPanel);
    }
Ejemplo n.º 5
0
    //显示
    public override void OnShow(params object[] args)
    {
        //寻找组件
        idText        = skin.transform.Find("InfoPanel/IdText").GetComponent <Text>();
        scoreText     = skin.transform.Find("InfoPanel/ScoreText").GetComponent <Text>();
        createButton  = skin.transform.Find("CtrlPanel/CreateButton").GetComponent <Button>();
        reflashButton = skin.transform.Find("CtrlPanel/ReflashButton").GetComponent <Button>();
        content       = skin.transform.Find("ListPanel/Scroll View/Viewport/Content");
        roomObj       = skin.transform.Find("Room").gameObject;
        tankCamera    = skin.transform.Find("InfoPanel/TankCamera").gameObject;
        //不激活房间
        roomObj.SetActive(false);
        //显示id
        idText.text = GameMain.id;
        //按钮事件
        createButton.onClick.AddListener(OnCreateClick);
        reflashButton.onClick.AddListener(OnReflashClick);
        //协议监听
        NetManager.AddMsgListener("MsgGetAchieve", OnMsgGetAchieve);
        NetManager.AddMsgListener("MsgGetRoomList", OnMsgGetRoomList);
        NetManager.AddMsgListener("MsgCreateRoom", OnMsgCreateRoom);
        NetManager.AddMsgListener("MsgEnterRoom", OnMsgEnterRoom);
        //发送查询
        MsgGetAchieve msgGetAchieve = new MsgGetAchieve();

        NetManager.Send(msgGetAchieve);
        MsgGetRoomList msgGetRoomList = new MsgGetRoomList();

        NetManager.Send(msgGetRoomList);
        //创建坦克模型
        GameObject tankSkin = ResManager.LoadPrefab("tankPrefab");

        tankObj = (GameObject)Instantiate(tankSkin, tankCamera.transform);
        tankObj.transform.localPosition = new Vector3(0, -2, 25);
        tankObj.transform.Rotate(0, 90, -30);
    }
Ejemplo n.º 6
0
    //收到成绩查询协议
    public void OnMsgGetAchieve(MsgBase msgBase)
    {
        MsgGetAchieve msg = (MsgGetAchieve)msgBase;

        scoreText.text = msg.win + "胜 " + msg.lost + "负";
    }