Exemplo n.º 1
0
 public override void OnAwake()
 {
     DiceTcpOperation = new GameDiceTcpRoomOperation();
     base.OnAwake();
     btn_Kick = XUIUtils.GetCompmentT <Button>(transform, "btn_Kick");
     XUIUtils.ListenerBtn(btn_Kick, BtnKickOnClick);
 }
Exemplo n.º 2
0
    public override void OnAwake()
    {
        MessageManager.GetInstance.InsertUIDict(this.GetType(), this);
        canvas = GameObject.Find("Canvas").transform;
        //PlayerCache.CurrentSceneReconnectionMsg = msg;
        AudioManager.Instance.StopBgAudio();
        AudioManager.Instance.PlayerBgAudio("DiceBG");
        PostionModelList = new List <PostionModel>();
        VIPImages        = new List <Sprite>();
        BetSpriteList    = new List <Sprite>();
        ChipBtnList      = new List <Button>();
        BetImageList     = new List <Image>();
        BetBtnList       = new List <Button>();
        RoundBtnList     = new List <Transform>();
        SeatPlayerList   = new List <Button>();
        SeatList         = new List <Button>();
        DiceTcpOperation = new GameDiceTcpRoomOperation();
        //获取人物头像
        PlayerIma = XUIUtils.GetCompmentT <Image>(transform, "PlayerIma");
        //获取人物名称
        PlayerName = XUIUtils.GetCompmentT <Text>(transform, "PlayerIma/PlayerName");
        //获取人物金币数量
        PlayerGoldCount = XUIUtils.GetCompmentT <Text>(transform, "PlayerIma/GoldCound");
        //获取人物VIP标
        VIPbiao = XUIUtils.GetCompmentT <Image>(transform, "PlayerIma/VIPbiao");
        //获取返回按钮并绑定事件
        backBtn = XUIUtils.GetCompmentT <Button>(transform, "BackBtn");
        XUIUtils.ListenerBtn(backBtn, BackBtnOnclick);
        ////获取广播消息按钮并绑定事件
        //noticeBtn = XUIUtils.GetCompmentT<Button>(transform, "NoticeBG/noticeBtn");
        //XUIUtils.ListenerBtn(noticeBtn, NoticeBtnObclick);
        ////获取商城入口按钮绑定事件
        storeBtn = XUIUtils.GetCompmentT <Button>(transform, "StorePorchBtn");
        XUIUtils.ListenerBtn(storeBtn, StoreBtnOnclick);
        //获取排名按钮绑定事件
        rankingBtn = XUIUtils.GetCompmentT <Button>(transform, "Button/RankingBtn");
        XUIUtils.ListenerBtn(rankingBtn, RankngBtnOnclick);
        //获取排行页面
        rankingPanel = XUIUtils.GetCompmentT <Transform>(transform, "RankingPanel");
        //获取周排行Toggle
        WeekToggle = XUIUtils.GetCompmentT <Toggle>(transform, "RankingPanel/WeekToggle");
        WeekToggle.onValueChanged.AddListener(WeekToggleonclick);
        //获取昨日排行页面
        YesterDayPanel = XUIUtils.GetCompmentT <Transform>(transform, "RankingPanel/YesterDayShowBg/YesterDayShowPanel");
        //获取周排行榜页面
        WeekPanel = XUIUtils.GetCompmentT <Transform>(transform, "RankingPanel/WeekShowBg/WeekShowPanel");
        //获取排行预设物
        yesterItem = Resources.Load <GameObject>("Prefabs/Game/WanRenChang/YesterDayitem");
        //给排行图片数组添加元素
        rankingIarray = new Sprite[] { Resources.Load <Sprite>("Sprite/Rank/new_rank_no1"),
                                       Resources.Load <Sprite>("Sprite/Rank/new_rank_no2"), Resources.Load <Sprite>("Sprite/Rank/new_rank_no3") };
        //获取排行页面返回按钮绑定事件
        rankBackBtn = rankingPanel.GetChild(4).GetComponent <Button>();
        XUIUtils.ListenerBtn(rankBackBtn, RankPanelBackBtn);
        //获取时时乐按钮添加点击事件
        shishileBtn = XUIUtils.GetCompmentT <Button>(transform, "ShiShiLeBtn");
        XUIUtils.ListenerBtn(shishileBtn, BtnShishileOnClick);
        //获取消息页面
        ChatPanel = XUIUtils.GetCompmentT <Transform>(transform, "ChatPanel");
        //获取打开消息按钮绑定点击事件
        openChatBtn = XUIUtils.GetCompmentT <Button>(transform, "Button/OpenChatBtn");
        XUIUtils.ListenerBtn(openChatBtn, openChatOnclick);
        //获取到VIP图片并进行添加
        for (int i = 1; i < 26; i++)
        {
            VIPImages.Add(GameTools.Instance.GetSpriteAtlas("Sprite/VIPBiao/VIPBiao", "VIP" + i.ToString()));
        }
        //获取到触摸反馈页面添加点击事件
        TouchPanel = XUIUtils.GetCompmentT <Button>(transform, "TouchPanel");
        XUIUtils.ListenerBtn(TouchPanel, TouchOnclick);
        //获取显示筹码预设物
        BetChip = Resources.Load <GameObject>("Prefabs/Game/Dice/BetChip");
        //显示筹码图片链表添加元素
        BetSpriteList.Add(GameTools.Instance.GetSpriteAtlas("Sprite/chip/ChipAtlas", "chip_500000"));
        BetSpriteList.Add(GameTools.Instance.GetSpriteAtlas("Sprite/chip/ChipAtlas", "chip_1000000"));
        BetSpriteList.Add(GameTools.Instance.GetSpriteAtlas("Sprite/chip/ChipAtlas", "chip_5000000"));
        BetSpriteList.Add(GameTools.Instance.GetSpriteAtlas("Sprite/chip/ChipAtlas", "chip_10000000"));
        BetSpriteList.Add(GameTools.Instance.GetSpriteAtlas("Sprite/chip/ChipAtlas", "chip_50000000"));
        //投注区域
        BetArea = XUIUtils.GetCompmentT <Transform>(transform, "BetButton");
        //给所有的投注区域按钮添加点击事件
        for (int i = 0; i < BetArea.childCount; i++)
        {
            BetImageList.Add(BetArea.GetChild(i).GetComponent <Image>());
            int j = i;
            BetImageList[j].alphaHitTestMinimumThreshold = 0.3f;
            if (i == 1 | i == 13 | i == 14 | i == 16 | i == 17)
            {
                RoundBtnList.Add(BetArea.GetChild(i).GetChild(0).transform);
            }
            BetBtnList.Add(BetArea.GetChild(i).GetComponent <Button>());
            int x = i;
            BetBtnList[x].onClick.AddListener(delegate() { BetBtnOnclick(x); });
        }
        //筹码值数组添加元素
        ChipValueList = new int[5] {
            500000, 1000000, 5000000, 10000000, 50000000
        };
        //获取筹码区遍历子物体存进筹码数组
        ChipArea = XUIUtils.GetCompmentT <Transform>(transform, "ChipArea");
        for (int i = 0; i < ChipArea.childCount; i++)
        {
            ChipBtnList.Add(ChipArea.GetChild(i).GetComponent <Button>());
            int j = i;
            ChipBtnList[j].onClick.AddListener(delegate() { StakeCountonclick(j); });
        }
        //获取筹码遮盖
        ChipShade = XUIUtils.GetCompmentT <Transform>(transform, "ChipShade");
        //下注筹码生成区
        BetChipPos = XUIUtils.GetCompmentT <Transform>(transform, "BetChipPos");
        //筹码落点链表赋值
        PostionModel postionModel1;

        postionModel1.DX = -355; postionModel1.XX = -420; postionModel1.DY = 143; postionModel1.XY = 70;
        PostionModelList.Add(postionModel1);
        PostionModel postionModel2;

        postionModel2.DX = -270; postionModel2.XX = -290; postionModel2.DY = 164; postionModel2.XY = 69;
        PostionModelList.Add(postionModel2);
        PostionModel postionModel3;

        postionModel3.DX = -377; postionModel3.XX = -344; postionModel3.DY = 34; postionModel3.XY = -100;
        PostionModelList.Add(postionModel3);
        PostionModel postionModel4;

        postionModel4.DX = -245; postionModel4.XX = -290; postionModel4.DY = 34; postionModel4.XY = -100;
        PostionModelList.Add(postionModel4);
        PostionModel postionModel5;

        postionModel5.DX = -210; postionModel5.XX = -167; postionModel5.DY = 34; postionModel5.XY = -100;
        PostionModelList.Add(postionModel5);
        PostionModel postionModel6;

        postionModel6.DX = -126; postionModel6.XX = -60; postionModel6.DY = 34; postionModel6.XY = -100;
        PostionModelList.Add(postionModel6);
        PostionModel postionModel7;

        postionModel7.DX = -33; postionModel7.XX = 28; postionModel7.DY = 34; postionModel7.XY = -100;
        PostionModelList.Add(postionModel7);
        PostionModel postionModel8;

        postionModel8.DX = 110; postionModel8.XX = 60; postionModel8.DY = 34; postionModel8.XY = -100;
        PostionModelList.Add(postionModel8);
        PostionModel postionModel9;

        postionModel9.DX = 158; postionModel9.XX = 200; postionModel9.DY = 34; postionModel9.XY = -100;
        PostionModelList.Add(postionModel9);
        PostionModel postionModel10;

        postionModel10.DX = 275; postionModel10.XX = 254; postionModel10.DY = 34; postionModel10.XY = -100;
        PostionModelList.Add(postionModel10);
        PostionModel postionModel11;

        postionModel11.DX = 360; postionModel11.XX = 340; postionModel11.DY = 34; postionModel11.XY = -100;
        PostionModelList.Add(postionModel11);
        PostionModel postionModel12;

        postionModel12.DX = 280; postionModel12.XX = 260; postionModel12.DY = 164; postionModel12.XY = 69;
        PostionModelList.Add(postionModel12);
        PostionModel postionModel13;

        postionModel13.DX = 420; postionModel13.XX = 355; postionModel13.DY = 143; postionModel13.XY = 70;
        PostionModelList.Add(postionModel13);
        PostionModel postionModel14;

        postionModel14.DX = -184; postionModel14.XX = -210; postionModel14.DY = 164; postionModel14.XY = 69;
        PostionModelList.Add(postionModel14);
        PostionModel postionModel15;

        postionModel15.DX = -101; postionModel15.XX = -133; postionModel15.DY = 164; postionModel15.XY = 69;
        PostionModelList.Add(postionModel15);
        PostionModel postionModel16;

        postionModel16.DX = 53; postionModel16.XX = -61; postionModel16.DY = 164; postionModel16.XY = 69;
        PostionModelList.Add(postionModel16);
        PostionModel postionModel17;

        postionModel17.DX = 128; postionModel17.XX = 98; postionModel17.DY = 164; postionModel17.XY = 69;
        PostionModelList.Add(postionModel17);
        PostionModel postionModel18;

        postionModel18.DX = 202; postionModel18.XX = 181; postionModel18.DY = 164; postionModel18.XY = 69;
        PostionModelList.Add(postionModel18);

        //获取座位区域遍历子物体存进入座数组
        seat = XUIUtils.GetCompmentT <Transform>(transform, "Seat");
        for (int i = 0; i < seat.childCount; i++)
        {
            SeatList.Add(seat.GetChild(i).GetComponent <Button>());
            SeatPlayerList.Add(seat.GetChild(i).GetChild(0).GetComponent <Button>());
            int j = i;
            SeatList[j].onClick.AddListener(delegate() { HaveSeat(j); });
            SeatPlayerList[j].onClick.AddListener(delegate() { GetOtherPlayerinfo(j); });
        }

        //if (PlayerCache.newBroadcastMsg != null)
        //{
        //    ShowNewMsg(PlayerCache.newBroadcastMsg);
        //}
        // broadcastBar = noticeBtn.GetComponent<ScrollRect>();
    }