public static bool ApplyParamBust(ParamBustCustom source, DynamicBone_Ver02 target)
        {
            Regex regex = new Regex("_R$");

            //For Params
            //Parameter Patterns[0]="通常"
            target.setGravity(0, new UnityEngine.Vector3(0, source.gravity, 0));

            for (int i = 0; i < target.Patterns[0].Params.Count; i++)
            {
                string boneName = regex.Replace(target.Patterns[0].Params[i].Name, "_L");
                if (source.paramBones.ContainsKey(boneName))
                {
                    ParamBone parameterSet = source.paramBones[boneName];
                    if (parameterSet != null)
                    {
                        parameterSet.CopyParameterTo(target.Patterns[0].Params[i]);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            //For ParticlePtn
            //ParticlePtn Patterns[0]="通常"
            CopyParamsToParticlePtn(target);

            //For Particle. Must set at last.
            target.setPtn(0, true);

            return(true);
        }
 private void LoadParamFrom(ParamBustCustom param)
 {
     gravity = param.gravity;
     foreach (XMLParamSet set in paramSets)
     {
         set.CopyParameterFrom(param.paramBones[set.PartName]);
     }
 }
Ejemplo n.º 3
0
        public void CopyParamsFrom(ParamBustCustom source)
        {
            gravity = source.gravity;

            foreach (string bone in Bones)
            {
                paramBones[bone].CopyParameterFrom(source.paramBones[bone]);
            }
        }
Ejemplo n.º 4
0
        public static void SaveXMLBust(ParamBustCustom bust, string path)
        {
            XMLParamBust xml = new XMLParamBust(bust);

            using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
                using (StreamWriter sw = new StreamWriter(fs))
                {
                    xml.Serialize(sw);
                }
        }
Ejemplo n.º 5
0
 public static bool LoadXMLBust(ParamBustCustom bust, string path)
 {
     if (LoadXMLBust_ver1(bust, path))
     {
         return(true);
     }
     if (LoadXMLBust_ver2(bust, path))
     {
         return(true);
     }
     return(false);
 }
 public XMLParamBust(ParamBustCustom param)
 {
     gravity   = param.gravity;
     paramSets = new List <XMLParamSet>();
     foreach (string partName in partNames)
     {
         XMLParamSet set = new XMLParamSet();
         set.PartName = partName;
         paramSets.Add(set);
     }
     LoadParamFrom(param);
 }
Ejemplo n.º 7
0
        private static bool LoadXMLBust_ver2(ParamBustCustom bust, string path)
        {
            XMLParamBust xml_ver2 = new XMLParamBust();

            using (StreamReader reader = new System.IO.StreamReader(path))
            {
                if (!xml_ver2.Deserialize(reader))
                {
                    return(false);
                }
            }
            xml_ver2.CopyParams(bust);
            return(true);
        }
Ejemplo n.º 8
0
        private static bool LoadXMLBust_ver1(ParamBustCustom bust, string path)
        {
            XMLDynamicBoneParameter xml_ver1 = new XMLDynamicBoneParameter();

            using (StreamReader reader = new System.IO.StreamReader(path))
            {
                if (!xml_ver1.Deserialize(reader))
                {
                    return(false);
                }
            }
            xml_ver1.CopyParamsTo(bust);
            return(true);
        }
        public ParamChara()
        {
            paramBustNaked = new ParamBustCustom();
            //Create instance of breast's paramter per coordinates,wearStates.
            paramBust = new Dictionary <ChaFileDefine.CoordinateType, Dictionary <ParamCharaController.ParamsKind, ParamBustCustom> >();
            for (int coordinate = 0; coordinate < Coordinates.Count(); coordinate++)
            {
                Dictionary <ParamCharaController.ParamsKind, ParamBustCustom> parametersCoordinate = new Dictionary <ParamCharaController.ParamsKind, ParamBustCustom>();
                for (int wearState = 0; wearState < WearStates.Count(); wearState++)
                {
                    ParamBustCustom parameterBreast = new ParamBustCustom(Coordinates[coordinate], WearStates[wearState]);
                    parametersCoordinate.Add(WearStates[wearState], parameterBreast);
                }
                paramBust.Add(Coordinates[coordinate], parametersCoordinate);
            }

            //Hip Custom
            paramHip = new ParamHipCustom();
        }
Ejemplo n.º 10
0
        public ParamBustCustom Clone()
        {
            ParamBustCustom result;

            if (_wearState == ParamCharaController.ParamsKind.Naked)
            {
                result = new ParamBustCustom();
            }
            else
            {
                result = new ParamBustCustom(_coordinate, _wearState);
            }

            result.enabled = enabled;
            foreach (string bone in paramBones.Keys)
            {
                result.paramBones[bone] = paramBones[bone].Clone();
            }
            result.gravity = gravity;
            return(result);
        }
 public void CopyParams(ParamBustCustom target)
 {
     target.gravity = gravity;
     foreach (XMLParamSet set in paramSets)
     {
         set.CopyParameterTo(target.paramBones[set.PartName]);
         //switch(set.PartName)
         //{
         //    case "Bust01":
         //        set.CopyParameterTo(target.paramBones[ParamBustCustom.Bones[0]]);
         //        break;
         //    case "Bust02":
         //        set.CopyParameterTo(target.paramBones[ParamBustCustom.Bones[1]]);
         //        break;
         //    case "Bust03":
         //        set.CopyParameterTo(target.paramBones[ParamBustCustom.Bones[2]]);
         //        break;
         //    default:
         //        break;
         //}
     }
 }