Beispiel #1
0
    /// <summary>
    /// 加载匹配房间资源
    /// </summary>
    void LoadMatchingRoomResource()
    {
        if (GameMain.hall_.GameBaseObj == null || RoomTfm != null)
        {
            return;
        }

        AssetBundle bundle = AssetBundleManager.GetAssetBundle(GameDefine.HallAssetbundleName);

        if (bundle == null)
        {
            return;
        }

        Transform canvasTfm = GameObject.Find("Canvas/Root").transform;

        if (canvasTfm == null)
        {
            return;
        }

        string     PrefabName = CCsvDataManager.Instance.GameUIDataMgr.GetGameUIPrefabName("RoomTable", GameMain.hall_.GameBaseObj.GetGameType());
        GameObject obj        = (GameObject)bundle.LoadAsset(PrefabName);

        obj = Instantiate(obj);
        obj.SetActive(false);
        RoomTfm = obj.transform;
        RoomTfm.SetParent(canvasTfm, false);

        m_Scroll = RoomTfm.Find("PanelGame_").GetComponent <ScrollRect>();
        m_Scroll.onValueChanged.AddListener(OnScrollValueChange);
        m_Scroll.verticalScrollbar.value = 1f;

        RoomTfm.Find("PanelHead_/Button_Return").GetComponent <Button>().
        onClick.AddListener(() => OnClickReturn(3));
        RoomTfm.Find("PanelHead_/Button_matching").GetComponent <Button>().
        onClick.AddListener(OnClickQuickMatch);
        obj = RoomTfm.Find("PanelHead_/Image_DiamondFrame").gameObject;
        XPointEvent.AutoAddListener(obj, GameMain.hall_.Charge, Shop.SHOPTYPE.SHOPTYPE_DIAMOND);

        LoadMatchingTableResource(GameMain.hall_.GameBaseObj.GetGameType(), bundle);
    }
Beispiel #2
0
 public void SetUIAsLast()
 {
     if (m_nBystanderRoom > 0)
     {
         UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_APPLYTOBEONLOOKER);
         msg.Add(GameMain.hall_.GetPlayerId());
         msg.Add((uint)(GameKind_Enum.GameKind_CzMahjong));
         msg.Add(m_nBystanderRoom);
         HallMain.SendMsgToRoomSer(msg);
     }
     else
     {
         RoomTfm.SetAsLastSibling();
         if (TableTfm)
         {
             TableTfm.SetAsLastSibling();
             TableTfm.Find("bottom/Button_Ready").gameObject.SetActive(true);
         }
     }
 }
Beispiel #3
0
    public void ShowRoom(byte gameId)
    {
        AssetBundle bundle = AssetBundleManager.GetAssetBundle(GameDefine.HallAssetbundleName);

        if (bundle == null)
        {
            return;
        }

        GameData gamedata = CCsvDataManager.Instance.GameDataMgr.GetGameData(gameId);

        if (gamedata == null)
        {
            Debug.Log("初始化游戏失败,id:" + gameId.ToString());
            return;
        }

        RoomTfm.gameObject.SetActive(true);
        RoomTfm.Find("PanelHead_/Image_Icon").GetComponent <Image>().sprite = bundle.LoadAsset <Sprite>(gamedata.GameTextIcon);
        UpdateDiamond(GameMain.hall_.GetPlayerData().GetDiamond());
    }
Beispiel #4
0
 void UpdateDiamond(long num)
 {
     RoomTfm.Find("PanelHead_/Image_DiamondFrame/Text_Diamond").GetComponent <Text>().text
         = num.ToString();
 }