Esempio n. 1
0
    public void InitUI(GameObject mainui)
    {
        AssetBundle bundle = AssetBundleManager.GetAssetBundle(GameDefine.HallAssetbundleName);

        if (bundle)
        {
            Transform tfm = mainui.transform.Find("Panelbottom/Left");

            Button btn = tfm.Find("Button_checkin").GetComponent <Button>();
            btn.onClick.RemoveAllListeners();
            btn.onClick.AddListener(() => ShowSignIn(true));

            m_OldPlayerBtn = tfm.Find("Button_oldplayer").gameObject;
            btn            = m_OldPlayerBtn.GetComponent <Button>();
            btn.onClick.RemoveAllListeners();
            btn.onClick.AddListener(() => ShowOldPlayer(true));

            UnityEngine.Object obj;
            if (SignInTfm == null)
            {
                obj       = (GameObject)bundle.LoadAsset("Activity_checkin");
                SignInTfm = ((GameObject)GameMain.instantiate(obj)).transform;
                SignInTfm.SetParent(mainui.transform.parent, false);

                SignInTfm.Find("ImageBG/Button_get").GetComponent <Button>().onClick.AddListener(OnClickSign);

                SetupWeekSign();

                ShowSignIn(m_nSignState > 0 || m_nWeekAddState > 0);
            }

            if (OldPlayerTfm == null)
            {
                obj          = (GameObject)bundle.LoadAsset("Activity_oldplayer");
                OldPlayerTfm = ((GameObject)GameMain.instantiate(obj)).transform;
                OldPlayerTfm.SetParent(mainui.transform.parent, false);
                OldPlayerTfm.Find("ImageBG/cdkey/Button_Confirm").GetComponent <Button>().onClick.AddListener(OnClickCDKey);
                OldPlayerTfm.Find("ImageBG/gift_1/Button_group/Button_get").GetComponent <Button>().onClick.AddListener(OnClickGift);
                SetupOldPlayer();
                ShowOldPlayer(false);
            }

            if (AwardTfm == null)
            {
                obj      = (GameObject)bundle.LoadAsset("Tips_Buy");
                AwardTfm = ((GameObject)GameMain.instantiate(obj)).transform;
                AwardTfm.SetParent(SignInTfm.parent, false);
                AwardTfm.Find("ImageBG/GroupText/TextTop").GetComponent <Text>().text = "领取成功";
                AwardTfm.gameObject.SetActive(false);
            }
        }
    }
Esempio n. 2
0
    void OnClickCDKey()
    {
        Transform  tfm   = OldPlayerTfm.Find("ImageBG/cdkey/InputField");
        InputField field = tfm.GetComponent <InputField>();

        if (field.text.Length != 6)
        {
            CCustomDialog.OpenCustomConfirmUI(1402);
            return;
        }
        UMessage msg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CM_PLAYERAPPLYBINDINVITE);

        msg.Add(GameMain.hall_.GetPlayerId());
        msg.Add(field.text);
        NetWorkClient.GetInstance().SendMsg(msg);
    }
Esempio n. 3
0
    void SetupOldPlayer()
    {
        PlayerData playerdata = GameMain.hall_.GetPlayerData();
        bool       isBind     = playerdata.nIsBindInvite > 0;
        Transform  tfm        = OldPlayerTfm.Find("ImageBG/cdkey");

        tfm.gameObject.SetActive(!isBind);
        tfm = OldPlayerTfm.Find("ImageBG/gift_1");
        tfm.gameObject.SetActive(isBind);
        int index = playerdata.nIsBindInvite - 99;

        if (index > 7)
        {
            m_OldPlayerBtn.SetActive(false);
            index = 7;
            playerdata.nIsBindAward = 1;
        }

        tfm.Find("TextName").GetComponent <Text>().text = index.ToString() + "/7";
        if (playerdata.nIsBindAward > 0)
        {
            uint coin = index == 7 ? playerdata.nTodayAward : playerdata.nTomorrowAward;
            tfm.Find("Textinfo").GetComponent <Text>().text = coin.ToString() + "金币";
            tfm.Find("Button_group/Button_get").gameObject.SetActive(false);
            tfm = tfm.Find("Button_group/Text_tips");
            tfm.gameObject.SetActive(true);
            tfm.GetComponent <Text>().text = (index != 7) ? "明日登录可领取" : "已领取所有礼包";
        }
        else
        {
            uint coin = playerdata.nTodayAward;
            tfm.Find("Textinfo").GetComponent <Text>().text = coin.ToString() + "金币";
            tfm.Find("Button_group/Button_get").gameObject.SetActive(true);
            tfm.Find("Button_group/Text_tips").gameObject.SetActive(false);
        }
    }