Exemple #1
0
    void DeleteMail(ulong mailid)
    {
        foreach (UnityEngine.GameObject go in MailDic.Keys)
        {
            ArkCrossEngine.MailInfo minfo = MailDic[go];
            if (minfo != null && mailid == minfo.m_MailGuid)
            {
                MailDic.Remove(go);
                NGUITools.DestroyImmediate(go);

                MailStateDic.Remove(mailid);
                break;
            }
        }
        UpdateScrollView();
        UnityEngine.Transform tf = transform.Find("MetalFrame/Container/ScrollView/Grid");
        if (tf != null)
        {
            UIGrid ug = tf.gameObject.GetComponent <UIGrid>();
            if (ug != null)
            {
                ug.repositionNow = true;
            }
        }
        lastclickgo = null;
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        try
        {
            if (MailDic != null)
            {
                MailDic.Clear();
            }
            if (MailStateDic != null)
            {
                MailStateDic.Clear();
            }
            if (golist != null)
            {
                golist.Clear();
            }
            if (eventlist != null)
            {
                eventlist.Clear();
            }
            object eo = ArkCrossEngine.LogicSystem.EventChannelForGfx.Subscribe <List <ArkCrossEngine.MailInfo> >("ge_sync_mail_list", "mail", SyncMailList);
            if (eo != null)
            {
                eventlist.Add(eo);
            }
            eo = ArkCrossEngine.LogicSystem.EventChannelForGfx.Subscribe("ge_notify_new_mail", "mail", NewMail);
            if (eo != null)
            {
                eventlist.Add(eo);
            }
            eo = ArkCrossEngine.LogicSystem.EventChannelForGfx.Subscribe("ge_ui_unsubscribe", "ui", UnSubscribe);
            if (eo != null)
            {
                eventlist.Add(eo);
            }

            ArkCrossEngine.GfxSystem.EventChannelForLogic.Publish("ge_get_mail_list", "lobby");
            UIManager.Instance.HideWindowByName("Mail");
        }
        catch (System.Exception ex)
        {
            ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace);
        }
    }
Exemple #3
0
    void MailItemClick(UnityEngine.GameObject go)
    {
        if (go != null && MailDic.ContainsKey(go))
        {
            ClearIntroduce();
            ArkCrossEngine.MailInfo minfo = MailDic[go];
            SetMailIntroduceInfo(minfo);

            if (MailStateDic[minfo.m_MailGuid] == false)
            {
                ArkCrossEngine.GfxSystem.EventChannelForLogic.Publish("ge_read_mail", "lobby", minfo.m_MailGuid);
                MailStateDic[minfo.m_MailGuid] = true;
                CheckHasUnReadMail();
            }

            UnityEngine.Transform tf = go.transform.Find("MailImage");
            if (tf != null)
            {
                UISprite us = tf.gameObject.GetComponent <UISprite>();
                if (us != null)
                {
                    us.spriteName = "mail2";
                }
            }
            tf = go.transform.Find("Frame");
            if (tf != null)
            {
                NGUITools.SetActive(tf.gameObject, true);
            }
            if (lastclickgo != null)
            {
                tf = lastclickgo.transform.Find("Frame");
                if (tf != null)
                {
                    NGUITools.SetActive(tf.gameObject, false);
                }
            }
            lastclickgo = go;
        }
    }
Exemple #4
0
 void AddMail(ArkCrossEngine.MailInfo mailinfo)
 {
     if (mailinfo != null)
     {
         UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Mail/MailItem"));
         if (go != null)
         {
             UnityEngine.Transform tf = gameObject.transform.Find("MetalFrame/Container/ScrollView/Grid");
             if (tf != null)
             {
                 go = NGUITools.AddChild(tf.gameObject, go);
                 if (go != null)
                 {
                     UIEventListener.Get(go).onClick = MailItemClick;
                     MailDic.Add(go, mailinfo);
                     MailStateDic.Add(mailinfo.m_MailGuid, mailinfo.m_AlreadyRead);
                     SetMailItemInfo(go, mailinfo);
                 }
             }
         }
     }
 }
Exemple #5
0
 public void UnSubscribe()
 {
     try
     {
         if (eventlist != null)
         {
             for (int i = 0; i < eventlist.Count; i++)
             {
                 if (eventlist[i] != null)
                 {
                     ArkCrossEngine.LogicSystem.EventChannelForGfx.Unsubscribe(eventlist[i]);
                 }
             }
         }
         eventlist.Clear();
         MailDic.Clear();
         MailStateDic.Clear();
         golist.Clear();
     }
     catch (Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }