示例#1
0
    public void SetDesignated(PlayerInfo info)
    {
        mPlayerInfo = info;
        mState      = BtnPosition.STATE.Designated;
        transform.FindChild("Designated").gameObject.SetActive(true);
        transform.FindChild("Undesignated").gameObject.SetActive(false);

//		StartCoroutine(LoadImage(info.photoUrl, transform.FindChild("Photo").GetComponent<UITexture>()));
        mNeedPhoto = true;
        transform.FindChild("Designated").FindChild("LblPosition").GetComponent <UILabel>().text = info.position;
        transform.FindChild("Designated").FindChild("LblSalary").GetComponent <UILabel>().text   = info.salary + "";

        if (Localization.language.Equals("English"))
        {
            transform.FindChild("Designated").FindChild("LblTeam")
            .GetComponent <UILabel>().text = info.city + " " + info.teamName;
            transform.FindChild("Designated").FindChild("LblName")
            .GetComponent <UILabel>().text = info.firstName + " " + info.lastName;
            if (transform.FindChild("Designated").FindChild("LblName").GetComponent <UILabel>().width > 232)
            {
                transform.FindChild("Designated").FindChild("LblName").GetComponent <UILabel>().text
                    = info.firstName.Substring(0, 1) + ". " + info.lastName;
            }
        }
        else
        {
            transform.FindChild("Designated").FindChild("LblTeam")
            .GetComponent <UILabel>().text = info.korTeamName;
            transform.FindChild("Designated").FindChild("LblName")
            .GetComponent <UILabel>().text = info.korName;
        }

        TeamScheduleInfo schedule = null;

        foreach (TeamScheduleInfo team in UserMgr.ScheduleList)
        {
            if (info.team == team.awayTeamId ||
                info.team == team.homeTeamId)
            {
                if (team.dateTime.Equals(
                        transform.root.FindChild("RegisterEntry").GetComponent <RegisterEntry>().mContestInfo.startTime))
                {
                    schedule = team;
                    break;
                }
            }
        }

        if (schedule != null)
        {
            transform.FindChild("Designated").FindChild("LblYear").GetComponent <UILabel>().text
                = schedule.awayTeam + "  @  " + schedule.homeTeam;
        }
        else
        {
            transform.FindChild("Designated").FindChild("LblYear").gameObject.SetActive(false);
        }
    }
    void InitItem(UIListItem item, int index)
    {
        PlayerInfo info = mPlayerList[index];

        if (info.IsCard)
        {
            item.Target.transform.FindChild("Main").gameObject.SetActive(false);
            item.Target.transform.FindChild("Sub").gameObject.SetActive(true);

            Transform tf = item.Target.transform.FindChild("Sub");
            Debug.Log("korname is " + info.korName);
            tf.GetComponent <ItemSelectPlayerSub>().mPlayerInfo = info;

            tf.FindChild("LblSalaryB").GetComponent <UILabel>().text
                = "[s]$ " + UtilMgr.AddsThousandsSeparator(info.salary_org + "");
            tf.FindChild("LblSalary").GetComponent <UILabel>().text
                = "$ " + UtilMgr.AddsThousandsSeparator(info.salary + "");
            tf.FindChild("Level").FindChild("LblLV").FindChild("Label").GetComponent <UILabel>().text
                = info.level + "";
            tf.FindChild("LblSkill").FindChild("Label").GetComponent <UILabel>().text
                = "1";
            tf.FindChild("SprPhoto").GetComponent <UISprite>().spriteName = "starcard_" + info.grade;

            for (int i = 0; i < 6; i++)
            {
                tf.FindChild("Level").FindChild("Star" + (i + 1)).GetComponent <UISprite>()
                .color = new Color(102f / 255f, 102f / 255f, 102f / 255f);
            }

            for (int i = 0; i < info.grade; i++)
            {
                tf.FindChild("Level").FindChild("Star" + (i + 1)).GetComponent <UISprite>()
                .color = new Color(252f / 255f, 133f / 255f, 53f / 255f);
            }
        }
        else
        {
            item.Target.transform.FindChild("Main").gameObject.SetActive(true);
            item.Target.transform.FindChild("Sub").gameObject.SetActive(false);

            Transform tf = item.Target.transform.FindChild("Main");

            tf.GetComponent <ItemSelectPlayerMain>().mPlayerInfo      = info;
            tf.FindChild("LblPosition").GetComponent <UILabel>().text = info.position;
            if (Localization.language.Equals("English"))
            {
                tf.FindChild("LblName").GetComponent <UILabel>().text = info.firstName + " " + info.lastName;
                if (tf.FindChild("LblName").GetComponent <UILabel>().width > 232)
                {
                    tf.FindChild("LblName").GetComponent <UILabel>().text = info.firstName.Substring(0, 1) + ". " + info.lastName;
                }
                tf.FindChild("LblTeam").GetComponent <UILabel>().text = info.city + " " + info.teamName;
            }
            else
            {
                tf.FindChild("LblName").GetComponent <UILabel>().text = info.korName;
                tf.FindChild("LblTeam").GetComponent <UILabel>().text = info.korTeamName;
            }

            tf.FindChild("LblFPPG").FindChild("LblFPPGV").GetComponent <UILabel>().text
                = string.Format("{0:F1}", info.fppg);
            tf.FindChild("LblPlayed").FindChild("LblPlayedV").GetComponent <UILabel>().text
                = info.games + "";

//			tf.FindChild("LblYear").GetComponent<UILabel>().gameObject.SetActive(false);
            tf.FindChild("LblSalary").GetComponent <UILabel>().text = "$ " + UtilMgr.AddsThousandsSeparator(info.salary);


            item.Target.transform.FindChild("Main").FindChild("MLB").gameObject.SetActive(false);
            item.Target.transform.FindChild("Main").FindChild("KBO").gameObject.SetActive(true);
            tf = item.Target.transform.FindChild("Main").FindChild("KBO");

            if ((info.injuryYN != null) && (info.injuryYN.Equals("Y")))
            {
                tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("SprInjury").gameObject.SetActive(true);
            }
            else
            {
                tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("SprInjury").gameObject.SetActive(false);
            }

            TeamScheduleInfo schedule = null;
            foreach (TeamScheduleInfo team in UserMgr.ScheduleList)
            {
                if (info.team == team.awayTeamId ||
                    info.team == team.homeTeamId)
                {
                    if (team.dateTime.Equals(
                            transform.root.FindChild("RegisterEntry").GetComponent <RegisterEntry>().mContestInfo.startTime))
                    {
                        schedule = team;
                        break;
                    }
                }
            }

            if (schedule != null)
            {
                item.Target.transform.FindChild("Main").FindChild("LblYear").GetComponent <UILabel>().text
                    = schedule.awayTeam + "  @  " + schedule.homeTeam;
            }
            else
            {
                item.Target.transform.FindChild("Main").FindChild("LblYear").gameObject.SetActive(false);
            }

            tf.FindChild("BtnPhoto")
            .FindChild("Panel").FindChild("TxtPlayer").GetComponent <UITexture>().mainTexture
                = UtilMgr.GetTextureDefault();
            tf.FindChild("BtnPhoto")
            .FindChild("Panel").FindChild("TxtPlayer").GetComponent <UITexture>().color
                = new Color(1f, 1f, 1f, 50f / 255f);

            UtilMgr.LoadImage(info.playerId
                              , tf.FindChild("BtnPhoto")
                              .FindChild("Panel").FindChild("TxtPlayer").GetComponent <UITexture>());
        }
    }
示例#3
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);
    }