Beispiel #1
0
    private static ClothData RandomGenClothParts(ClothParts type, CharaData.Gender gender)
    {
        //ジェンダー別のGroupIDリスト取得
        List <string> groupIdList = ClothDataTableObject.Instance.GetGroupIdList(gender, type);

        if (groupIdList.Count == 0)
        {
            return(null);
        }

        //服のグループIDを取得
        int    rnd     = UnityEngine.Random.Range(0, groupIdList.Count);
        string groupId = groupIdList[rnd];

        //服のIDを取得
        string clothId = GetClothingID(type, groupId);

        //ClothDataを取得(あるかどうか確認)
        ClothData clothData = ClothDataTableObject.Instance.GetParams(clothId);

        if (clothData != null)
        {
            return(clothData);
        }

        return(null);
    }
    /**
     *
     * type別にグループIDのリストを選出。
     * TODO: スピード
     *
     *
     */
    public List <string> GetGroupIdList(CharaData.Gender gender, ClothingSystem.ClothParts type)
    {
        string searchGroup = "mc";

        if (gender == CharaData.Gender.Female)
        {
            searchGroup = "fc";
        }

        List <string> groupList = new List <string> ();

        foreach (ClothData data in _table.All)
        {
            //男女で区別
            if (!data.Name.Contains(searchGroup))
            {
                continue;
            }

            //探してるtypeかどうかチェック
            string searchingID = ClothingSystem.GetClothingID(type, data.GroupID);
            if (data.ID != searchingID)
            {
                continue;
            }

            groupList.Add(data.GroupID);
        }

        return(groupList);
    }
    /**
     *
     * 性別のGroupIDのリストを取得。
     *
     */
    public List <string> GetGroupIdList(CharaData.Gender gender)
    {
        if (gender == CharaData.Gender.Male && maleGroupIdList.Count > 0)
        {
            return(maleGroupIdList);
        }
        if (gender == CharaData.Gender.Female && femaleGroupIdList.Count > 0)
        {
            return(femaleGroupIdList);
        }

        GetGroupIdList();
        foreach (string groupId in groupIdList)
        {
            if (groupId.Contains("mc"))
            {
                maleGroupIdList.Add(groupId);
            }
            else
            {
                femaleGroupIdList.Add(groupId);
            }
        }

        if (gender == CharaData.Gender.Male)
        {
            return(maleGroupIdList);
        }

        return(femaleGroupIdList);
    }
Beispiel #4
0
    /**
     *
     * 性別を元に、
     * 服の形と色をランダムに決める。
     *
     * キャラオブジェクトが指定されてた場合はオブジェクトに服を着せる。
     * そうでない場合は服のstringデータをかえす。
     *
     * 返り値はセーブ用のデータ文字列。
     * <箇所>@<服グループID>@<R>&<G>&<B>|
     *
     * ex)
     * hair@GroupID@r&g&b|eye@GroupID@r&g&b|....
     *
     *
     */
    public static string AutoClothGenerator(CharaData.Gender gender = CharaData.Gender.Male, ClothingSystem CharacterObject = null)
    {
        string clothDataStr = "";
        //髪
        Color     rndColor  = RandomGenColor();
        ClothData clothData = RandomGenClothParts(ClothParts.HAIR, gender);

        if (CharacterObject != null)
        {
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.HAIR, clothData.GroupID, rndColor);
        }
        if (clothData != null)
        {
            clothDataStr = ClothParts.HAIR + "@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
        }

        //目
        rndColor  = RandomGenColor();
        clothData = RandomGenClothParts(ClothParts.EYES, gender);
        if (CharacterObject != null)
        {
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.EYES, clothData.GroupID, rndColor);
        }
        if (clothData != null)
        {
            clothDataStr += ClothParts.EYES + "@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
        }

        //胸
        if (gender == CharaData.Gender.Female)
        {
            rndColor  = RandomGenColor();
            clothData = RandomGenClothParts(ClothParts.CHEST, gender);
            if (CharacterObject != null)
            {
                CharacterObject.SetClothParts(ClothingSystem.ClothParts.CHEST, clothData.GroupID, rndColor);
            }
            if (clothData != null)
            {
                clothDataStr += ClothParts.CHEST + "@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
            }
        }

        //服
        rndColor  = RandomGenColor();
        clothData = RandomGenClothParts(ClothParts.BODY, gender);
        if (CharacterObject != null)
        {
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.BODY, clothData.GroupID, rndColor);
        }
        if (clothData != null)
        {
            clothDataStr += ClothParts.BODY + "@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
        }

        //腕
        rndColor  = RandomGenColor();
        clothData = RandomGenClothParts(ClothParts.ARM_L, gender);
        if (CharacterObject != null)
        {
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.ARM_L, clothData.GroupID, rndColor);
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.ARM_R, clothData.GroupID, rndColor);
        }
        if (clothData != null)
        {
            clothDataStr += "ARM_L@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
            clothDataStr += "ARM_R@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
        }

        //腰
        rndColor  = RandomGenColor();
        clothData = RandomGenClothParts(ClothParts.HIP, gender);
        if (CharacterObject != null)
        {
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.HIP, clothData.GroupID, rndColor);
        }
        if (clothData != null)
        {
            clothDataStr += ClothParts.HIP + "@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
        }

        //足
        rndColor  = RandomGenColor();
        clothData = RandomGenClothParts(ClothParts.LEG_UPPER_L, gender);
        if (CharacterObject != null)
        {
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.LEG_UPPER_L, clothData.GroupID, rndColor);
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.LEG_UPPER_R, clothData.GroupID, rndColor);
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.LEG_LOWER_L, clothData.GroupID, rndColor);
            CharacterObject.SetClothParts(ClothingSystem.ClothParts.LEG_LOWER_R, clothData.GroupID, rndColor);
        }
        if (clothData != null)
        {
            clothDataStr += "LEG_UPPER_L@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
            clothDataStr += "LEG_UPPER_R@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
            clothDataStr += "LEG_LOWER_L@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b + "|";
            clothDataStr += "LEG_LOWER_R@" + clothData.GroupID + "@" + rndColor.r + "&" + rndColor.g + "&" + rndColor.b;
        }

        //もしも"|"で終わっていたら削る
        if (clothDataStr.EndsWith("|"))
        {
            clothDataStr = clothDataStr.Substring(0, clothDataStr.Length - 1);
        }

        return(clothDataStr);
    }