Exemple #1
0
    public static void JceImageNotice(AmUser User)
    {
        Ag.LogStartWithStr(2, "   JceImageNotice  >>      Started   .........  . . . . . . ");
        WebClient webClient = new WebClient();

        webClient.QueryString.Add("game_code", "113");
        webClient.QueryString.Add("client_secret", "5423b620768434b2a928e2cc62af2785");

        //NoticeUrl = "http://dev-sys.m.joycity.com/";
        //string result = webClient.DownloadString (JCE.NoticeUrl + "image-notice/list");

        Joycity.arrImageNoti.Clear();

        string result;

        if (!JCE.WebDownloadString(webClient, JCE.NoticeUrl + "image-notice/list", out result))
        {
            return;
        }

        ("   JceImageNotice  >>  Received :::   " + result).HtLog();
        JSONNode jnObj = JSON.Parse(result);

        if (jnObj ["status"].AsInt == 1)
        {
            JSONNode imgNtc = jnObj ["result"] ["imageNotice"];
            Ag.LogString(" JceImageNotice ::  Count  " + imgNtc.Count);
            for (int k = 0; k < imgNtc.Count; k++)
            {
                JceImgNotice img = new JceImgNotice(jnObj ["timestamp"]);
                img.ParseFrom(imgNtc [k]);
                if (img.platform == 0 || img.platform == AgStt.JoyplePlatformID)
                {
                    Joycity.arrImageNoti.Add(img);
                }
            }
        }
        else
        {
            Ag.LogIntenseWord("Joyple Login Failed ....      Error      ....    ");
        }
        return;
    }
    /// <summary>
    /// 이미지 공지사항 출력
    /// </summary>
    /// <param name="pCount">P count.</param>
    void ImageBanner(int pCount)
    {
        GameObject Gobj;
        string     StampFreq, StampTime;
        double     PresentStamp, PresentTime;

        Ag.LogIntenseWord("    Image Banner >>>>>>>>>>>>>>>>>   ");
        for (int i = 0; i < pCount; i++)
        {
            JceImgNotice curNoti = Joycity.arrImageNoti [i];
            // Time Stamp Setting ...
            //string timeKey = "JoyCityImageBanner" + curNoti.idx;
            string timeKey = "JoyCityImageBanner" + curNoti.idx;
            StampTime = PreviewLabs.PlayerPrefs.GetString(timeKey);
            if (string.IsNullOrEmpty(StampTime))
            {
                StampTime = "1390441587486";
            }

            PresentStamp = double.Parse(Joycity.arrImageNoti [i].timestamp);
            Material ImageBannerPic;
            ImageBannerPic = Instantiate(Resources.Load("Materials/Imagebanner")) as Material;

            if (curNoti.IsFreqency)
            {
                Ag.LogString("    it's frequency ....    " + ("JoyCityImageBanner1" + curNoti.idx));
                StampFreq = PreviewLabs.PlayerPrefs.GetString("JoyCityImageBannerFreq" + curNoti.idx);
                if (string.IsNullOrEmpty(StampFreq))
                {
                    curNoti.AlreadySeenNum = 0;
                    Ag.LogDouble(" TextBanner >>>   IsFrequency..  first time  " + curNoti.frequency_time + "   AlreadySeen : " + curNoti.AlreadySeenNum);
                }
                else
                {
                    try {
                        curNoti.AlreadySeenNum = int.Parse(StampFreq);
                        Ag.LogDouble(" TextBanner >>>   IsFrequency..  time ?  " + curNoti.AlreadySeenNum);
                    } catch {
                        Ag.LogIntenseWord(" TextBanner >>>   Catch .... >>>>    Error   ");
                        curNoti.AlreadySeenNum = 1;
                    }

                    if (curNoti.AlreadySeenNum >= int.Parse(curNoti.frequency_time))
                    {
                        continue;
                    }
                }
            }

            Gobj = (GameObject)Instantiate(Resources.Load("prefab_General/Lpanel_Event"));
            Gobj.transform.parent        = dicMenuList ["Ui_lobby"].gameObject.transform;
            Gobj.transform.localPosition = new Vector3(0, 0, -295 - i * 60);
            Gobj.transform.localScale    = new Vector3(1, 1, 1);
            Gobj.name = "JoyCityImageBanner" + curNoti.idx;
            Gobj.GetComponent <CloseThisObject> ().mTimestamp = Joycity.arrImageNoti [i].timestamp;
            Gobj.GetComponent <CloseThisObject> ().JceNotiObj = curNoti;
            Ag.LogIntenseWord(Joycity.arrImageNoti [i].platform.ToString() + "PlatformNum");

            Gobj.transform.FindChild("banner").gameObject.GetComponent <UITexture> ().material = ImageBannerPic;

            Gobj.GetComponent <CloseThisObject> ().mUrl = Joycity.arrImageNoti [i].url;

            StartCoroutine(JoycityImageBannerLoad(Joycity.arrImageNoti [i].image_path, Gobj.transform.FindChild("banner").gameObject));
            mRscrcMan.AddComponentUISendMessage(mRscrcMan.FindChild(Gobj, "btn_close", true), Gobj, "DestoryObj");
            mRscrcMan.AddComponentUISendMessage(mRscrcMan.FindChild(Gobj, "btn_datail", true), Gobj, "OpenUrl");

            try {
                if (Ag.UnixTimeStampToDateTimeAddmili(double.Parse(StampTime)).AddDays(1) > Ag.UnixTimeStampToDateTimeAddmili(PresentStamp))
                {
                    Gobj.SetActive(false);
                }
            } catch {
                Ag.LogIntenseWord("ImageBanner Error");
            }
        }
    }