Ejemplo n.º 1
0
    private void OnWatchMail(EventTriggerType eventtype, object button, PointerEventData eventData)
    {
        if (eventtype == EventTriggerType.PointerClick && m_MailinfoTransform != null)
        {
            CustomAudio.GetInstance().PlayCustomAudio(1002);

            Transform ImageBGTransform = m_MailinfoTransform.Find("ImageBG");

            uint       key    = (uint)button;
            GameObject itembg = ImageBGTransform.Find("Viewport/Content").gameObject;
            GameMain.hall_.ClearChilds(itembg);

            Text infomation = ImageBGTransform.Find("Textinfo").gameObject.GetComponent <Text>();
            infomation.text = EmailDataManager.GetNewsInstance().emilsdata_[key].infomation;

            GameObject confirmbtn = ImageBGTransform.Find("Button_queding").gameObject;
            confirmbtn.SetActive(true);
            confirmbtn.GetComponent <Button>().interactable = true;

            GameObject getbtn = ImageBGTransform.Find("Button_lingqu").gameObject;
            getbtn.SetActive(false);

            XPointEvent.AutoAddListener(confirmbtn, OnCloseMailPanelWithCloseMsg, key);

            m_MailinfoTransform.gameObject.SetActive(true);
        }
    }
Ejemplo n.º 2
0
    private void OnGetGoodsFromMail(EventTriggerType eventtype, object button, PointerEventData eventData)
    {
        if (eventtype == EventTriggerType.PointerClick && m_MailinfoTransform != null)
        {
            CustomAudio.GetInstance().PlayCustomAudio(1002);

            AssetBundle bundle = AssetBundleManager.GetAssetBundle(GameDefine.HallAssetbundleName);
            if (bundle == null)
            {
                return;
            }

            AssetBundle bagbundle = AssetBundleManager.GetAssetBundle(GameDefine.HallBagIconAssetBundleName);
            if (bagbundle == null)
            {
                return;
            }

            Transform ImageBGTransform = m_MailinfoTransform.Find("ImageBG");

            uint       key    = (uint)button;
            GameObject itembg = ImageBGTransform.Find("Viewport/Content").gameObject;
            GameMain.hall_.ClearChilds(itembg);

            Text infomation = ImageBGTransform.Find("Textinfo").gameObject.GetComponent <Text>();
            infomation.text = EmailDataManager.GetNewsInstance().emilsdata_[key].infomation;

            GameObject confirmbtn = ImageBGTransform.Find("Button_queding").gameObject;
            confirmbtn.SetActive(false);
            GameObject getbtn = ImageBGTransform.Find("Button_lingqu").gameObject;
            getbtn.SetActive(true);
            getbtn.GetComponent <Button>().interactable = true;

            XPointEvent.AutoAddListener(getbtn, OnGetGoods, key);

            for (int index = 0; index < EmailDataManager.GetNewsInstance().emilsdata_[key].emailitems.Count; index++)
            {
                uint itemid = EmailDataManager.GetNewsInstance().emilsdata_[key].emailitems[index].itemid;

                UnityEngine.Object obj0    = (GameObject)bundle.LoadAsset("mail_icon");
                GameObject         itemobj = (GameObject)GameMain.instantiate(obj0);

                itemobj.transform.SetParent(itembg.transform, false);

                Image icon = itemobj.transform.Find("Imageicon").gameObject.GetComponent <Image>();
                icon.sprite = bagbundle.LoadAsset <Sprite>(BagDataManager.GetBagDataInstance().GetItemData(itemid).itemIcon);
                Text number = itemobj.transform.Find("Textnum").gameObject.GetComponent <Text>();
                number.text = EmailDataManager.GetNewsInstance().emilsdata_[key].emailitems[index].itemNumber.ToString();
            }

            m_MailinfoTransform.gameObject.SetActive(true);
        }
    }
Ejemplo n.º 3
0
    bool BackMailGetReward(uint _msgType, UMessage msg)
    {
        byte state = msg.ReadByte();

        if (state == 0) //没找到邮件
        {
            CCustomDialog.OpenCustomConfirmUI(1703);
            return(false);
        }
        else if (state == 1)
        {
            CCustomDialog.OpenCustomConfirmUI(1702);
        }

        uint mailid = msg.ReadUInt();

        if (emailobjects_.ContainsKey(mailid))
        {
            GameMain.safeDeleteObj(emailobjects_[mailid]);
            emailobjects_.Remove(mailid);
        }

        if (EmailDataManager.GetNewsInstance().emilsdata_.ContainsKey(mailid))
        {
            EmailDataManager.GetNewsInstance().emilsdata_.Remove(mailid);
            SetNoMailUI();
        }

        if (m_MailinfoTransform)
        {
            m_MailinfoTransform.Find("ImageBG/Button_lingqu").GetComponent <Button>().interactable  = true;
            m_MailinfoTransform.Find("ImageBG/Button_queding").GetComponent <Button>().interactable = true;
            m_MailinfoTransform.gameObject.SetActive(false);
        }

        //if(GameMain.hall_.contestui_ != null)
        //    GameMain.hall_.contestui_.transform.FindChild("Panelbottom/Bottom/Button_News/ImageSpot").gameObject.SetActive(EmailDataManager.GetNewsInstance().emilsdata_.Count > 0);
        GameMain.hall_.GetPlayerData().mailNumber -= 1;
        GameMain.hall_.m_Bulletin.OnEmailChange(EmailDataManager.GetNewsInstance().emilsdata_.Count <= 0);

        return(true);
    }
Ejemplo n.º 4
0
    bool BackMailData(uint _msgType, UMessage msg)
    {
        byte length = msg.ReadByte();

        EmailDataManager.GetNewsInstance().emilsdata_.Clear();
        for (int index = 0; index < length; index++)
        {
            EmailData data = new EmailData();

            data.emailid  = msg.ReadUInt();
            data.hasread  = msg.ReadByte();
            data.sendid   = msg.ReadUInt();
            data.sendName = msg.ReadString();
            uint emailtime = msg.ReadUInt();
            data.rewardSorce      = (MailFrom_Enum)msg.ReadByte();
            data.sorceID          = msg.ReadUInt();
            data.contestSort      = msg.ReaduShort();
            data.titleid          = msg.ReadUInt();
            data.contentID        = msg.ReadUInt();
            data.specialDiscript1 = msg.ReadString();
            data.specialDiscript2 = msg.ReadString();

            data.gamekind = msg.ReadByte();

            data.emailname = CCsvDataManager.Instance.TipsDataMgr.GetTipsData(data.titleid).TipsText;
            TipsData tdata = CCsvDataManager.Instance.TipsDataMgr.GetTipsData(data.contentID);

            byte flag = msg.ReadByte();
            if (GameKind.HasFlag(0, flag))
            {
                data.masterReward = msg.ReadSingle();
            }
            if (GameKind.HasFlag(1, flag))
            {
                data.diamondReward = msg.ReadUInt();
            }
            if (GameKind.HasFlag(2, flag))
            {
                data.coinReward = msg.ReadUInt();
            }

            for (int itemindex = 3; itemindex < 6; itemindex++)
            {
                if (GameKind.HasFlag(itemindex, flag))
                {
                    Item item = new Item();
                    item.itemid     = msg.ReaduShort();
                    item.itemNumber = msg.ReadByte();
                    data.emailitems.Add(item);
                }
            }

            if (GameKind.HasFlag(6, flag))
            {
                data.redbag = msg.ReadSingle();
            }

            if (data.rewardSorce == MailFrom_Enum.MailFrom_Contest)
            {
                int starttime = 0;
                int.TryParse(data.specialDiscript1, out starttime);

                System.DateTime stsdt       = GameCommon.ConvertLongToDateTime(starttime);
                string          contenttime = stsdt.ToString("yyyy年MM月dd日HH:mm");

                System.DateTime sdt = GameCommon.ConvertLongToDateTime(emailtime);
                data.emailtime = sdt.ToString("yyyy年MM月dd日HH:mm");

                string rewardcontent = "";
                if (GameKind.HasFlag(0, flag))
                {
                    rewardcontent += "大师分:" + data.masterReward.ToString();
                }
                if (GameKind.HasFlag(6, flag))
                {
                    rewardcontent += " 现金红包:" + data.redbag.ToString() + "元";
                }
                if (GameKind.HasFlag(1, flag) || GameKind.HasFlag(2, flag))
                {
                    rewardcontent += " 钻石:" + (data.diamondReward + data.coinReward).ToString();
                }

                object[] args = { contenttime, "<color=#FF8C00>" + data.specialDiscript2 + "</color>", data.contestSort, rewardcontent };

                string formatcontent = string.Format(tdata.TipsText, args);
                data.infomation = formatcontent;
            }
            else if (data.rewardSorce == MailFrom_Enum.MailFrom_MomentsKick)
            {
                System.DateTime sdt = GameCommon.ConvertLongToDateTime(emailtime);
                data.emailtime = sdt.ToString("yyyy年MM月dd日HH:mm");

                object[] args = { data.specialDiscript1 };

                string formatcontent = string.Format(tdata.TipsText, args);
                data.infomation = formatcontent;
            }
            else if (data.rewardSorce == MailFrom_Enum.MailFrom_ContestCutCreditScore)
            {
                int starttime = 0;
                int.TryParse(data.specialDiscript1, out starttime);

                System.DateTime stsdt       = GameCommon.ConvertLongToDateTime(starttime);
                string          contenttime = stsdt.ToString("yyyy年MM月dd日HH:mm");

                System.DateTime sdt = GameCommon.ConvertLongToDateTime(emailtime);
                data.emailtime = sdt.ToString("yyyy年MM月dd日HH:mm");

                object[] args = { contenttime, "<color=#FF8C00>" + data.specialDiscript2 + "</color>" };

                string formatcontent = string.Format(tdata.TipsText, args);
                data.infomation = formatcontent;
            }

            //if (data.emailitems.Count == 0 || (data.masterReward == 0 && data.diamondReward == 0 && data.coinReward == 0))
            if (GameKind.HasFlag(3, flag) || GameKind.HasFlag(4, flag) ||
                GameKind.HasFlag(5, flag))
            {
                data.emailtype = MailType.HASGOODS;
            }
            else
            {
                data.emailtype = MailType.READONLY;
            }

            EmailDataManager.GetNewsInstance().emilsdata_.Add(data.emailid, data);
        }

        if (root_ == null)
        {
            LoadNewsResource();
        }

        InitNewsUIData();

        //root_.SetActive(false);
        GameMain.hall_.GetPlayerData().mailNumber = (byte)EmailDataManager.GetNewsInstance().emilsdata_.Count;

        return(true);
    }
Ejemplo n.º 5
0
    public void InitNewsUIData()
    {
        AssetBundle bundle = AssetBundleManager.GetAssetBundle(GameDefine.HallAssetbundleName);

        if (bundle == null)
        {
            return;
        }

        if (root_ == null)
        {
            return;
        }

        GameObject emailbg = root_.transform.Find("ImageBG/Viewport/Content").gameObject;

        GameMain.hall_.ClearChilds(emailbg);
        //foreach (uint key in emailobjects_.Keys)
        //    GameMain.safeDeleteObj(emailobjects_[key]);
        emailobjects_.Clear();

        //int length = EmailDataManager.GetNewsInstance().emilsdata_.Count;
        //root_.transform.FindChild("ImageBG").FindChild("Viewport").FindChild("Imagekong").gameObject.SetActive(length == 0);
        SetNoMailUI();

        List <uint> keys = new List <uint>(EmailDataManager.GetNewsInstance().emilsdata_.Keys);

        keys.Reverse();

        foreach (uint key in keys)
        {
            UnityEngine.Object obj0     = (GameObject)bundle.LoadAsset("mail_list");
            GameObject         mailitem = (GameObject)GameMain.instantiate(obj0);
            mailitem.transform.SetParent(emailbg.transform, false);

            //Image icon = mailitem.transform.FindChild("Imageicon").gameObject.GetComponent<Image>();
            //icon.sprite = bundle.LoadAsset<Sprite>(EmailDataManager.GetNewsInstance().emilsdata_[key].emailicon);
            GameObject notread = mailitem.transform.Find("Imageicon").Find("Imageitem").gameObject;
            notread.SetActive(EmailDataManager.GetNewsInstance().emilsdata_[key].hasread == 0);
            Text name = mailitem.transform.Find("Textname").gameObject.GetComponent <Text>();
            name.text = EmailDataManager.GetNewsInstance().emilsdata_[key].emailname;
            Text time = mailitem.transform.Find("Texttime").gameObject.GetComponent <Text>();
            time.text = EmailDataManager.GetNewsInstance().emilsdata_[key].emailtime;

            GameObject seebtn = mailitem.transform.Find("Button_chakan").gameObject;
            seebtn.SetActive(false);
            GameObject getbtn = mailitem.transform.Find("Button_lingqu").gameObject;
            getbtn.SetActive(false);

            if (EmailDataManager.GetNewsInstance().emilsdata_[key].emailtype == MailType.READONLY)
            {
                seebtn.SetActive(true);
                XPointEvent.AutoAddListener(seebtn, OnWatchMail, EmailDataManager.GetNewsInstance().emilsdata_[key].emailid);
            }
            if (EmailDataManager.GetNewsInstance().emilsdata_[key].emailtype == MailType.HASGOODS)
            {
                getbtn.SetActive(true);
                XPointEvent.AutoAddListener(getbtn, OnGetGoodsFromMail, EmailDataManager.GetNewsInstance().emilsdata_[key].emailid);
            }

            emailobjects_.Add(key, mailitem);
        }

        //if(GameMain.hall_.contestui_ != null)
        //    GameMain.hall_.contestui_.transform.FindChild("Panelbottom/Bottom/Button_News/ImageSpot").gameObject.SetActive(EmailDataManager.GetNewsInstance().emilsdata_.Count > 0);
    }
Ejemplo n.º 6
0
    void SetNoMailUI()
    {
        int length = EmailDataManager.GetNewsInstance().emilsdata_.Count;

        root_.transform.Find("ImageBG").Find("Viewport").Find("Imagekong").gameObject.SetActive(length == 0);
    }