Esempio n. 1
0
    void OnGameBegin(string str, System.Object obj)
    {
        EventMgr.NetMsg msg  = (EventMgr.NetMsg)obj;
        BeginData       info = (BeginData)msg.para;

        bGameStation = 20;
        isMyBet      = false;
        PlayGameSound(2, "start");
        mainUI.ClearDesktopMoney();
        mainUI.ClearDesktopClip();
        mainUI.SetNotice("游戏开始了,请您下分...");
        mainUI.szLimit    = info.m_iShangZhuangLimit;
        currZhuangStation = info.m_iNowNtStation;
        currZScore        = info.m_iNTdata [2];
        currZTScore       = info.m_iNTdata [1];
        currGameCount     = info.m_iNTdata[3] + 1;
        foreach (UserInfoStruct user in onLineUsers)
        {
            if (info.m_iNTdata[0] == (int)user.bDeskStation)
            {
                currZName = user.GetNickName();
            }
        }
        mainUI.ShowZhuangInfo(currZName, currZScore, currZTScore, currGameCount);
        //处理游戏开始UI逻辑
        ShowSzList(info.m_iNTlist);
        Show30History(info.m_iResultInfo);
        mainUI.SetXiafenItem(info.m_iMaxZhu);
        if (currZhuangStation == (int)myInfo.bDeskStation)
        {
            mainUI.InitMoneyDisable(0);             //自己是庄家,禁用
        }
        else
        {
            mainUI.InitMoneyDisable(betTotalMoney);
        }
        xzCDTime = info.m_iXiaZhuTime;
        kpCDTime = info.m_iKaiPaiTime;
        kxCDTime = info.m_iFreeTime;
        ShowCountDownTime("下注时间", Time.time, xzCDTime, CalcXZTime);
    }
Esempio n. 2
0
    void Start()
    {
        Debug.LogWarning("BaiStart start()");
        GameObject cv = GameObject.Find("ContextView");

        if (cv != null)
        {
            cv.transform.Find("UI Root").gameObject.SetActive(false);
        }

        SetAllPackageItemExtension();

        GRoot.inst.SetContentScaleFactor(1136, 640);
        UIPackage.AddPackage("baijiale/baijiale");
        mainUI = UIPackage.CreateObject("baijiale", "main") as UI_main;
        GRoot.inst.AddChild(mainUI);

        head = mainUI.GetChild("head") as UI_Head;
        GButton quit = head.GetChild("quitBtn").asButton;

        quit.onClick.Add(OnLeave);

        Screen.orientation = ScreenOrientation.Landscape;


        //add by zjl
        mainUI.SetNotice("游戏服务器连接中....");
        TimeManager.Instance().UnRegister("loadGame");
        Loading.GetInstance().HideLoading();

        //添加事件监听器
        EventMgr.ins.AddEventListener("1_3", OnConnSucc);           //游戏服务器连接成功
        //登录
        EventMgr.ins.AddEventListener("100_4", OnLoginSucc);        //登录游戏服务器成功
        EventMgr.ins.AddEventListener("100_3", OnLoginError);       //登录游戏服务器失败
        //玩家
        EventMgr.ins.AddEventListener("101_1", OnOnLineUserInfos);  //推送在线玩家信息
        EventMgr.ins.AddEventListener("101_2", OnOffLineUserInfos); //推送掉线玩家信息
        //桌子位置
        EventMgr.ins.AddEventListener("102_1", OnUpSucc);           //玩家起身成功信息
        EventMgr.ins.AddEventListener("102_2", OnSitSucc);          //玩家坐下成功信息
        EventMgr.ins.AddEventListener("102_8", OnSitError);         //玩家坐下失败信息
        //进入&离开
        EventMgr.ins.AddEventListener("102_5", OnUserEnterSucc);    //玩家进入游戏信息
        EventMgr.ins.AddEventListener("102_6", OnUserLeftSucc);     //玩家离开游戏信息
        //金钱
        EventMgr.ins.AddEventListener("103_6", OnUserMoneyUpdate);  //玩家金币更新
        //游戏
        EventMgr.ins.AddEventListener("150_1", OnGameStatus);       //游戏状态
        EventMgr.ins.AddEventListener("150_2", OnGameScenes);       //游戏场景

        EventMgr.ins.AddEventListener("180_130", OnXiaZhu);         //游戏下注
        EventMgr.ins.AddEventListener("180_133", OnShangZhuang);    //游戏上庄

        EventMgr.ins.AddEventListener("180_134", OnGameBegin);      //游戏开始
        EventMgr.ins.AddEventListener("180_131", OnKaiPai);         //游戏开牌
        EventMgr.ins.AddEventListener("180_136", OnGameJieSuan);    //游戏结算

        EventMgr.ins.AddEventListener("1000_02", OnNetError);       //断线重连

        GameSocket.GetInstance().Connect(Global.CurrentSelGameRoom.GetSzServiceIP(), (int)Global.CurrentSelGameRoom.uServicePort);
    }