Exemplo n.º 1
0
    public void Init(string name, DancerInfo.Country country, GameObject bindingObj)
    {
        m_Name.text         = name;
        m_BindingGameObject = bindingObj;

        float nameWidth  = m_Name.preferredWidth;
        float width      = nameWidth + m_Country.rectTransform.sizeDelta.x + Interval;
        float deltaWidth = (width - nameWidth) / 2f;

        m_Name.rectTransform.localPosition    = new Vector3(deltaWidth, 0, 0);
        m_Country.rectTransform.localPosition = new Vector3(-(nameWidth - width / 2f + Interval + m_Country.rectTransform.sizeDelta.x / 2f), 0, 0);

        switch (country)
        {
        case DancerInfo.Country.America:
            m_Country.sprite = Resources.Load <Sprite>("CityFlag/en_US");
            break;

        case DancerInfo.Country.China:
            m_Country.sprite = Resources.Load <Sprite>("CityFlag/zh_CN");
            break;
        }

        m_StartBinding = true;


        StartCoroutine(DelayShow());
    }
Exemplo n.º 2
0
    public static DancerInfo GetNPCDancer(bool betterOne, int wholeScore, DancerInfo.Country country, DancerInfo.Sex sex, int maxScore, int clickMaxScore, List <string> typeList)
    {
        DancerInfo dancer = new DancerInfo();

        if (country == DancerInfo.Country.China)
        {
            dancer.Name = RoleManager.RandomUserNickName(LanguageType.Chinese);
        }
        else
        {
            dancer.Name = RoleManager.RandomUserNickName(LanguageType.English);
        }

        dancer.m_Country = country;
        dancer.m_Sex     = sex;
        if (betterOne)
        {
            dancer.WholeScore    = UnityEngine.Random.Range(wholeScore + 1, maxScore);
            dancer.m_RankingType = DancerInfo.RankingType.Winner;
        }
        else
        {
            dancer.WholeScore    = UnityEngine.Random.Range(0, wholeScore);
            dancer.m_RankingType = DancerInfo.RankingType.Loser;
        }

        dancer.ClickScore          = UnityEngine.Random.Range(0, dancer.WholeScore);
        dancer.VoiceScore          = dancer.WholeScore - dancer.ClickScore;
        dancer.WholeRankingPercent = (float)dancer.WholeScore / maxScore;
        dancer.ClickScorePercent   = (float)dancer.ClickScore / clickMaxScore;
        dancer.VoiceScorePercent   = (float)dancer.VoiceScore / (maxScore - clickMaxScore);

        string tempType = RoleModelConfig.Instance.GetNameById(UnityEngine.Random.Range(20001, 20009));

        while (typeList.Contains(tempType))
        {
            tempType = RoleModelConfig.Instance.GetNameById(UnityEngine.Random.Range(20001, 20009));
        }
        typeList.Add(tempType);

        dancer.ModelID  = tempType;
        dancer.FaceID   = RoleEmotionConfig.Instance.GetNameById(UnityEngine.Random.Range(30001, 30009));
        dancer.PlayerID = "npc";

        return(dancer);
    }