public void Open(CustomMailType mailType)
    {
        this.m_CUIForm = Singleton <CUIManager> .GetInstance().OpenForm(CMailSys.MAIL_FORM_PATH, false, true);

        if (this.m_CUIForm == null)
        {
            return;
        }
        this.m_CUIListScriptTab = this.m_CUIForm.transform.FindChild("TopCommon/Panel_Menu/ListMenu").GetComponent <CUIListScript>();
        this.m_CUIListScriptTab.SetElementAmount(4);
        this.m_CUIListScriptTab.GetElemenet(0).transform.FindChild("Text").GetComponent <Text>().set_text(Singleton <CTextManager> .GetInstance().GetText("Mail_Friend"));
        this.m_CUIListScriptTab.GetElemenet(1).transform.FindChild("Text").GetComponent <Text>().set_text(Singleton <CTextManager> .GetInstance().GetText("Mail_System"));
        this.m_CUIListScriptTab.GetElemenet(2).transform.FindChild("Text").GetComponent <Text>().set_text(Singleton <CTextManager> .GetInstance().GetText("Mail_MsgCenter"));
        this.m_CUIListScriptTab.GetElemenet(3).transform.FindChild("Text").GetComponent <Text>().set_text(Singleton <CTextManager> .GetInstance().GetText("Mail_Ask_For_Tab"));
        this.m_CUIListScriptTab.GetElemenet(0).GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.Mail_TabFriend);
        this.m_CUIListScriptTab.GetElemenet(1).GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.Mail_TabSystem);
        this.m_CUIListScriptTab.GetElemenet(2).GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.Mail_TabMsgCenter);
        this.m_CUIListScriptTab.GetElemenet(3).GetComponent <CUIEventScript>().SetUIEvent(enUIEventType.Click, enUIEventID.Mail_TabGiftCenter);
        this.m_panelFri                 = this.m_CUIForm.transform.FindChild("PanelFriMail").gameObject;
        this.m_panelSys                 = this.m_CUIForm.transform.FindChild("PanelSysMail").gameObject;
        this.m_panelMsg                 = this.m_CUIForm.transform.FindChild("PanelMsgMail").gameObject;
        this.m_panelAskFor              = this.m_CUIForm.transform.FindChild("PanelAskForMail").gameObject;
        this.m_SysDeleteBtn             = this.m_panelSys.transform.FindChild("ButtonGrid/DeleteButton").gameObject;
        this.m_AskForDeleteBtn          = this.m_panelAskFor.transform.FindChild("ButtonGrid/DeleteButton").gameObject;
        this.m_allReceiveSysButton      = this.m_panelSys.transform.FindChild("ButtonGrid/AllReceiveButton").gameObject;
        this.m_allReceiveFriButton      = this.m_panelFri.transform.FindChild("AllReceiveButton").gameObject;
        this.m_allDeleteMsgCenterButton = this.m_panelMsg.transform.FindChild("AllDeleteButton").gameObject;
        this.SetUnReadNum(CustomMailType.FRIEND, this.m_friUnReadNum);
        this.SetUnReadNum(CustomMailType.SYSTEM, this.m_sysUnReadNum);
        this.SetUnReadNum(CustomMailType.FRIEND_INVITE, this.m_msgUnReadNum);
        this.SetUnReadNum(CustomMailType.ASK_FOR, this.m_askForUnReadNum);
        this.CurMailType = mailType;
    }
Example #2
0
        public CMail(CustomMailType mailType, ref CSDT_ASKFORREQ_DETAIL pkg)
        {
            this.mailType  = mailType;
            this.subType   = (byte)mailType;
            this.mailIndex = pkg.iReqIndex;
            this.mailState = ((pkg.bIsRead > 0) ? COM_MAIL_STATE.COM_MAIL_HAVEREAD : COM_MAIL_STATE.COM_MAIL_UNREAD);
            this.autoDel   = false;
            this.from      = Utility.UTF8Convert(pkg.stReqInfo.szAcntName);
            this.sendTime  = pkg.stReqInfo.dwReqTime;
            COM_ITEM_TYPE wItemType = (COM_ITEM_TYPE)pkg.stReqInfo.stReqItem.wItemType;
            uint          dwItemID  = pkg.stReqInfo.stReqItem.dwItemID;
            int           dwItemCnt = (int)pkg.stReqInfo.stReqItem.dwItemCnt;
            CUseable      cUseable  = CUseableManager.CreateUseable(wItemType, dwItemID, dwItemCnt);

            if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
            {
                this.subject = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSkinBuy_Ask_For_Mail_Title_Skin"), cUseable.m_name);
            }
            else
            {
                this.subject = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSkinBuy_Ask_For_Mail_Title_Hero"), cUseable.m_name);
            }
            if (pkg.stReqInfo.stMsgInfo.bMsgType == 1)
            {
                this.mailContent = StringHelper.UTF8BytesToString(ref pkg.stReqInfo.stMsgInfo.stMsgInfo.stMsgString.szContentStr);
                if (string.IsNullOrEmpty(this.mailContent))
                {
                    this.mailContent = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSKinBuy_Ask_For_Default_Msg"), cUseable.m_name);
                }
            }
            else
            {
                uint  dwMsgID = pkg.stReqInfo.stMsgInfo.stMsgInfo.stMsgIDInfo.dwMsgID;
                ulong num     = Convert.ToUInt64(dwMsgID);
                num <<= 32;
                int              num2      = Convert.ToInt32(wItemType);
                long             key       = (long)(num + (ulong)((long)num2));
                ResAskforTemplet dataByKey = GameDataMgr.askForTemplateDatabin.GetDataByKey(key);
                if (dataByKey == null)
                {
                    this.mailContent = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSKinBuy_Ask_For_Default_Msg"), cUseable.m_name);
                }
                else
                {
                    this.mailContent = string.Format(dataByKey.szContent, cUseable.m_name);
                }
            }
            this.accessUseableGeted = 0;
            this.accessUseable.Clear();
            this.accessUseable.Add(cUseable);
        }
Example #3
0
 public CMail(CustomMailType mailType, ref CSDT_GETMAIL_RES pkg)
 {
     this.mailType           = mailType;
     this.subType            = pkg.bMailType;
     this.mailIndex          = pkg.iMailIndex;
     this.mailState          = (COM_MAIL_STATE)pkg.bMailState;
     this.autoDel            = (pkg.bAutoDel > 0);
     this.from               = Utility.UTF8Convert(pkg.szFrom);
     this.sendTime           = pkg.dwSendTime;
     this.subject            = Utility.UTF8Convert(pkg.szSubject, (int)pkg.bSubjectLen);
     this.accessUseableGeted = 0;
     this.accessUseable.Clear();
     this.accessUseable = CMailSys.StAccessToUseable(pkg.astAccess, null, (int)pkg.bAccessCnt);
     for (int i = 0; i < this.accessUseable.Count; i++)
     {
         if (pkg.astAccess[i].bGeted == 1)
         {
             this.accessUseableGeted |= 1 << i;
         }
     }
 }
    public void UpdateMailList(CustomMailType mailtype, ListView <CMail> mailList)
    {
        if (this.m_CUIForm == null || mailList == null)
        {
            return;
        }
        CUIListElementScript cUIListElementScript = null;
        int currentUTCTime = CRoleInfo.GetCurrentUTCTime();
        int num            = -1;

        if (mailtype == CustomMailType.FRIEND)
        {
            CUIListScript component = this.m_CUIForm.transform.FindChild("PanelFriMail/List").GetComponent <CUIListScript>();
            component.SetElementAmount(mailList.Count);
            for (int i = 0; i < mailList.Count; i++)
            {
                cUIListElementScript = component.GetElemenet(i);
                if (cUIListElementScript != null && cUIListElementScript.gameObject)
                {
                    this.UpdateListElenment(cUIListElementScript.gameObject, mailList[i]);
                }
                if (num == -1 && mailList[i].subType == 1)
                {
                    num = i;
                }
            }
            this.m_allReceiveFriButton.CustomSetActive(num >= 0);
        }
        else if (mailtype == CustomMailType.SYSTEM)
        {
            CUIListScript component2 = this.m_CUIForm.transform.FindChild("PanelSysMail/List").GetComponent <CUIListScript>();
            component2.SetElementAmount(mailList.Count);
            for (int j = 0; j < mailList.Count; j++)
            {
                if (cUIListElementScript != null && cUIListElementScript.gameObject)
                {
                    this.UpdateListElenment(cUIListElementScript.gameObject, mailList[j]);
                }
                if (num == -1 && mailList[j].subType == 2)
                {
                    num = j;
                }
            }
            this.m_allReceiveSysButton.CustomSetActive(num >= 0);
            this.m_SysDeleteBtn.CustomSetActive(mailList.Count > 0);
        }
        else if (mailtype == CustomMailType.FRIEND_INVITE)
        {
            CUIListScript component3 = this.m_CUIForm.transform.FindChild("PanelMsgMail/List").GetComponent <CUIListScript>();
            component3.SetElementAmount(mailList.Count);
            for (int k = 0; k < mailList.Count; k++)
            {
                if (cUIListElementScript != null && cUIListElementScript.gameObject)
                {
                    this.UpdateListElenment(cUIListElementScript.gameObject, mailList[k]);
                }
            }
            this.m_allDeleteMsgCenterButton.CustomSetActive(mailList.Count > 0);
        }
        else if (mailtype == CustomMailType.ASK_FOR)
        {
            GameObject gameObject     = Utility.FindChild(this.m_CUIForm.gameObject, "PanelAskForMail/NoAskFor");
            CRoleInfo  masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                if (gameObject != null)
                {
                    gameObject.GetComponent <Toggle>().set_isOn(masterRoleInfo.IsNoAskFor);
                }
            }
            else
            {
                DebugHelper.Assert(false, "Master Role Info is null");
                if (gameObject != null)
                {
                    gameObject.GetComponent <Toggle>().set_isOn(false);
                }
            }
            CUIListScript component4 = this.m_CUIForm.transform.FindChild("PanelAskForMail/List").GetComponent <CUIListScript>();
            component4.SetElementAmount(mailList.Count);
            this.m_allDeleteMsgCenterButton.CustomSetActive(false);
            this.m_allReceiveSysButton.CustomSetActive(false);
            this.m_AskForDeleteBtn.CustomSetActive(mailList.Count > 0);
        }
    }
 public void SetUnReadNum(CustomMailType mailtype, int unReadNum)
 {
     if (mailtype == CustomMailType.FRIEND)
     {
         this.m_friUnReadNum = unReadNum;
     }
     else if (mailtype == CustomMailType.SYSTEM)
     {
         this.m_sysUnReadNum = unReadNum;
     }
     else if (mailtype == CustomMailType.FRIEND_INVITE)
     {
         this.m_msgUnReadNum = unReadNum;
     }
     else if (mailtype == CustomMailType.ASK_FOR)
     {
         this.m_askForUnReadNum = unReadNum;
     }
     if (this.m_CUIListScriptTab == null)
     {
         return;
     }
     if (mailtype == CustomMailType.FRIEND && this.m_CUIListScriptTab.GetElemenet(0) != null)
     {
         if (unReadNum > 9)
         {
             CUICommonSystem.AddRedDot(this.m_CUIListScriptTab.GetElemenet(0).gameObject, enRedDotPos.enTopRight, 0, 0, 0);
         }
         else if (unReadNum > 0)
         {
             CUICommonSystem.AddRedDot(this.m_CUIListScriptTab.GetElemenet(0).gameObject, enRedDotPos.enTopRight, unReadNum, 0, 0);
         }
         else
         {
             CUICommonSystem.DelRedDot(this.m_CUIListScriptTab.GetElemenet(0).gameObject);
         }
     }
     else if (mailtype == CustomMailType.SYSTEM && this.m_CUIListScriptTab.GetElemenet(1) != null)
     {
         if (unReadNum > 9)
         {
             CUICommonSystem.AddRedDot(this.m_CUIListScriptTab.GetElemenet(1).gameObject, enRedDotPos.enTopRight, 0, 0, 0);
         }
         else if (unReadNum > 0)
         {
             CUICommonSystem.AddRedDot(this.m_CUIListScriptTab.GetElemenet(1).gameObject, enRedDotPos.enTopRight, unReadNum, 0, 0);
         }
         else
         {
             CUICommonSystem.DelRedDot(this.m_CUIListScriptTab.GetElemenet(1).gameObject);
         }
     }
     else if (mailtype == CustomMailType.FRIEND_INVITE && this.m_CUIListScriptTab.GetElemenet(2) != null)
     {
         if (unReadNum > 0)
         {
             CUICommonSystem.AddRedDot(this.m_CUIListScriptTab.GetElemenet(2).gameObject, enRedDotPos.enTopRight, 0, 0, 0);
         }
         else
         {
             CUICommonSystem.DelRedDot(this.m_CUIListScriptTab.GetElemenet(2).gameObject);
         }
     }
     else if (mailtype == CustomMailType.ASK_FOR && this.m_CUIListScriptTab.GetElemenet(3) != null)
     {
         if (unReadNum > 9)
         {
             CUICommonSystem.AddRedDot(this.m_CUIListScriptTab.GetElemenet(3).gameObject, enRedDotPos.enTopRight, 0, 0, 0);
         }
         else if (unReadNum > 0)
         {
             CUICommonSystem.AddRedDot(this.m_CUIListScriptTab.GetElemenet(3).gameObject, enRedDotPos.enTopRight, unReadNum, 0, 0);
         }
         else
         {
             CUICommonSystem.DelRedDot(this.m_CUIListScriptTab.GetElemenet(3).gameObject);
         }
     }
 }