Ejemplo n.º 1
0
    void InitGames()
    {
        Transform tf = transform.FindChild("Changeables").FindChild("Games");

        tf.gameObject.SetActive(true);
        UtilMgr.ClearList(tf.FindChild("Draggable"));
        tf.FindChild("Draggable").GetComponent <UIDraggablePanel2>().Init(mTeamEvent.Response.data.Count,
                                                                          delegate(UIListItem item, int index) {
            item.Target.transform.FindChild("SprLeft").FindChild("Label").GetComponent <UILabel>()
            .text = mTeamEvent.Response.data[index].awayTeamRuns + "";
            item.Target.transform.FindChild("SprRight").FindChild("Label").GetComponent <UILabel>()
            .text = mTeamEvent.Response.data[index].homeTeamRuns + "";
            item.Target.transform.FindChild("SprLeft").FindChild("SprEmblem").GetComponent <UISprite>()
            .spriteName = mTeamEvent.Response.data[index].awayTeamId + "";
            item.Target.transform.FindChild("SprRight").FindChild("SprEmblem").GetComponent <UISprite>()
            .spriteName = mTeamEvent.Response.data[index].homeTeamId + "";

            if (!UtilMgr.IsMLB())
            {
                item.Target.transform.FindChild("SprLeft").FindChild("SprEmblem").GetComponent <UISprite>().width   = 74;
                item.Target.transform.FindChild("SprLeft").FindChild("SprEmblem").GetComponent <UISprite>().height  = 60;
                item.Target.transform.FindChild("SprRight").FindChild("SprEmblem").GetComponent <UISprite>().width  = 74;
                item.Target.transform.FindChild("SprRight").FindChild("SprEmblem").GetComponent <UISprite>().height = 60;
            }


            item.Target.transform.FindChild("LblCenter").GetComponent <UILabel>()
            .text      = mTeamEvent.Response.data[index].awayTeam + "         " + mTeamEvent.Response.data[index].homeTeam;
            int hour   = int.Parse(mTeamEvent.Response.data[index].dateTime.Substring(8, 2));
            string min = mTeamEvent.Response.data[index].dateTime.Substring(10, 2);            //20160326220500

            if (UtilMgr.IsMLB())
            {
                item.Target.transform.FindChild("LblCenter").FindChild("LblUnder").GetComponent <UILabel>()
                .text = mTeamEvent.Response.data[index].day + " ET " + UtilMgr.GetAMPM(hour)[0] + ":" + min
                        + " " + UtilMgr.GetAMPM(hour)[1];
            }
            else
            {
                if (Localization.language.Equals("English"))
                {
                    item.Target.transform.FindChild("LblCenter").FindChild("LblUnder").GetComponent <UILabel>()
                    .text = mTeamEvent.Response.data[index].day + " KST " + UtilMgr.GetAMPM(hour)[0] + ":" + min
                            + " " + UtilMgr.GetAMPM(hour)[1];
                }
                else
                {
                    item.Target.transform.FindChild("LblCenter").FindChild("LblUnder").GetComponent <UILabel>()
                    .text = "KST " + UtilMgr.GetAMPM(hour)[0] + ":" + min
                            + " (" + UtilMgr.GetAMPM(hour)[1] + UtilMgr.DayToKorean(mTeamEvent.Response.data[index].day) + ")";
                }
            }
        });
        tf.FindChild("Draggable").GetComponent <UIDraggablePanel2>().ResetPosition();
    }
Ejemplo n.º 2
0
    bool InitPlayerInfo()
    {
//		if(UtilMgr.IsMLB()){
//			transform.FindChild("Info").FindChild ("MLB").gameObject.SetActive(true);
//			transform.FindChild("Info").FindChild ("KBO").gameObject.SetActive(false);
//
//			transform.FindChild("Info").FindChild ("MLB").FindChild("Panel").FindChild("Photo").GetComponent<UITexture>().mainTexture = mPhoto;
//		} else{
        transform.FindChild("Body").FindChild("Info").FindChild("MLB").gameObject.SetActive(false);
        transform.FindChild("Body").FindChild("Info").FindChild("KBO").gameObject.SetActive(true);
//		}
        mPlayerInfo = null;
        try{
            mPlayerInfo = UserMgr.PlayerDic[mPlayerId];
        }catch {}
//		foreach( in UserMgr.PlayerList){
//			if(info.playerId == ){

//				mPlayerInfo = info;
//				break;
//			}
//		}

        if (mPlayerInfo == null)
        {
//			IsInactive = true;
            DialogueMgr.ShowDialogue(UtilMgr.GetLocalText("StrPlayerInfo"), UtilMgr.GetLocalText("StrPlayerInactive")
                                     , DialogueMgr.DIALOGUE_TYPE.Alert, null);
            return(true);
        }

        if (mPlayerInfo.positionNo == 1)
        {
            IsPitcher = true;
            //					mHand = info.throwHand.Equals("L") ? UtilMgr.GetLocalText("StrLeft") : UtilMgr.GetLocalText("StrRight");
            if (mPlayerInfo.batHand == null)
            {
                mHand = "";
            }
            else if (mPlayerInfo.throwHand.Equals("S"))
            {
                mHand = UtilMgr.GetLocalText("StrSwitch");
            }
            else if (mPlayerInfo.throwHand.Equals("L"))
            {
                mHand = UtilMgr.GetLocalText("StrLeft");
            }
            else
            {
                mHand = UtilMgr.GetLocalText("StrRight");
            }
        }
        else
        {
            IsPitcher = false;
            //					mHand = info.batHand.Equals("L") ? UtilMgr.GetLocalText("StrLeft") : UtilMgr.GetLocalText("StrRight");
            if (mPlayerInfo.batHand == null)
            {
                mHand = "";
            }
            else if (mPlayerInfo.batHand.Equals("S"))
            {
                mHand = UtilMgr.GetLocalText("StrSwitch");
            }
            else if (mPlayerInfo.batHand.Equals("L"))
            {
                mHand = UtilMgr.GetLocalText("StrLeft");
            }
            else
            {
                mHand = UtilMgr.GetLocalText("StrRight");
            }
        }

        if (mPlayerInfo.injuryYN.Equals("N"))
        {
            transform.FindChild("Body").FindChild("Info").FindChild("Injury").gameObject.SetActive(false);
        }
        else
        {
            transform.FindChild("Body").FindChild("Info").FindChild("Injury").gameObject.SetActive(true);
        }

        if (UtilMgr.IsMLB())
        {
            if (mPlayerInfo.firstName.Length < 1)
            {
                transform.FindChild("Body").FindChild("Info").FindChild("LblName").GetComponent <UILabel>().text
                    = mPlayerInfo.lastName;
            }
            else
            {
                transform.FindChild("Body").FindChild("Info").FindChild("LblName").GetComponent <UILabel>().text
                    = mPlayerInfo.firstName.Substring(0, 1) + ". " + mPlayerInfo.lastName;
            }
        }
        else
        {
            if (Localization.language.Equals("English"))
            {
                if (mPlayerInfo.firstName.Length < 1)
                {
                    transform.FindChild("Body").FindChild("Info").FindChild("LblName").GetComponent <UILabel>().text
                        = mPlayerInfo.lastName;
                }
                else
                {
                    transform.FindChild("Body").FindChild("Info").FindChild("LblName").GetComponent <UILabel>().text
                        = mPlayerInfo.firstName.Substring(0, 1) + ". " + mPlayerInfo.lastName;
                }
            }
            else
            {
                transform.FindChild("Body").FindChild("Info").FindChild("LblName").GetComponent <UILabel>().text
                    = mPlayerInfo.korName;
            }
        }

        transform.FindChild("Body").FindChild("Info").FindChild("LblSaraly").GetComponent <UILabel>().text
            = "$" + mPlayerInfo.salary;
        transform.FindChild("Body").FindChild("Info").FindChild("LblFPPG").FindChild("Label").GetComponent <UILabel>().text
            = string.Format("{0:F1}", mPlayerInfo.fppg);
        transform.FindChild("Body").FindChild("Info").FindChild("LblPlayed").FindChild("Label").GetComponent <UILabel>().text
            = "" + mPlayerInfo.games;
        transform.FindChild("Body").FindChild("Info").FindChild("SprPos").FindChild("Label").GetComponent <UILabel>().text
            = mPlayerInfo.position;

        if (IsCard)
        {
            transform.FindChild("Body").FindChild("SprGrade").GetComponent <UISprite>().spriteName = "card_top_bg_" + mCardInfo.cardClass;
            transform.FindChild("Body").FindChild("SprGrade").gameObject.SetActive(true);
        }
        else
        {
            transform.FindChild("Body").FindChild("SprGrade").gameObject.SetActive(false);
        }

        TeamScheduleInfo schedule = null;

        foreach (TeamScheduleInfo info in UserMgr.ScheduleList)
        {
            if (mPlayerInfo.team == info.awayTeamId ||
                mPlayerInfo.team == info.homeTeamId)
            {
                schedule = info;
                break;
            }
        }

        if (schedule != null)
        {
            transform.FindChild("Body").FindChild("Info").FindChild("LblPos").GetComponent <UILabel>().text
                = schedule.awayTeam + "   @   " + schedule.homeTeam;

            int    hour = 1;
            string min  = "";
            if (UtilMgr.IsMLB())
            {
                hour = int.Parse(schedule.dateTime.Substring(8, 2));
                min  = schedule.dateTime.Substring(10, 2);
                transform.FindChild("Body").FindChild("Info").FindChild("LblTime").GetComponent <UILabel>().text
                    = schedule.day + " ET " + UtilMgr.GetAMPM(hour)[0] + ":" + min + " " + UtilMgr.GetAMPM(hour)[1];
            }
            else
            {
                hour = int.Parse(schedule.korDateTime.Substring(8, 2));
                min  = schedule.korDateTime.Substring(10, 2);
                if (Localization.language.Equals("English"))
                {
                    transform.FindChild("Body").FindChild("Info").FindChild("LblTime").GetComponent <UILabel>().text
                        = schedule.day + " KST " + UtilMgr.GetAMPM(hour)[0] + ":" + min + " " + UtilMgr.GetAMPM(hour)[1];
                }
                else
                {
                    transform.FindChild("Body").FindChild("Info").FindChild("LblTime").GetComponent <UILabel>().text
                        = "KST " + UtilMgr.GetAMPM(hour)[0] + ":" + min + " " +
                          UtilMgr.GetAMPM(hour)[1] + " (" + UtilMgr.DayToKorean(schedule.day) + ")";
                }
            }
        }

        if (mPhoto == null)
        {
            UtilMgr.LoadImage(mPlayerInfo.playerId,
                              transform.FindChild("Body").FindChild("Info").FindChild("KBO").FindChild("Panel")
                              .FindChild("Photo").GetComponent <UITexture>());
        }
        else
        {
            transform.FindChild("Body").FindChild("Info").FindChild("KBO").FindChild("Panel").FindChild("Photo")
            .GetComponent <UITexture>().mainTexture = mPhoto;
        }

        return(false);
    }