//写入数据 - Vector3数据
        void SBAddData(StringBuilder sb, HMotionEyeNeckMale.EyeNeck neck, string fieldName, int index)
        {
            Vector3 v = ((Vector3[])typeof(HMotionEyeNeckMale.EyeNeck).GetField(fieldName).GetValue(neck))[index];

            if (v.x != 0)
            {
                sb.Append($"<{v.x}>");
            }
            else
            {
                sb.Append("<>");
            }
            if (v.y != 0)
            {
                sb.Append($"<{v.y}>");
            }
            else
            {
                sb.Append("<>");
            }
            if (v.z != 0)
            {
                sb.Append($"<{v.z}>");
            }
            else
            {
                sb.Append("<>");
            }
        }
 //从原版中拷贝数据构造
 public MaleNeckData(HMotionEyeNeckMale.EyeNeck neck)
 {
     anim          = neck.anim;
     openEye       = neck.openEye;
     openMouth     = neck.openMouth;
     eyebrow       = neck.eyebrow;
     eye           = neck.eye;
     mouth         = neck.mouth;
     Neckbehaviour = neck.Neckbehaviour;
     Eyebehaviour  = neck.Eyebehaviour;
     targetNeck    = neck.targetNeck;
     NeckRot       = neck.NeckRot;
     HeadRot       = neck.HeadRot;
     targetEye     = neck.targetEye;
     EyeRot        = neck.EyeRot;
 }
 //转换为原版表情
 public HMotionEyeNeckMale.EyeNeck ToEyeNeck()
 {
     HMotionEyeNeckMale.EyeNeck neck = new HMotionEyeNeckMale.EyeNeck();
     neck.anim          = anim;
     neck.openEye       = openEye;
     neck.openMouth     = openMouth;
     neck.eyebrow       = eyebrow;
     neck.eye           = eye;
     neck.mouth         = mouth;
     neck.Neckbehaviour = Neckbehaviour;
     neck.Eyebehaviour  = Eyebehaviour;
     neck.targetNeck    = targetNeck;
     neck.NeckRot       = NeckRot;
     neck.HeadRot       = HeadRot;
     neck.targetEye     = targetEye;
     neck.EyeRot        = EyeRot;
     return(neck);
 }
        void GUIV3T(string target, int index)
        {
            enTmp = lst[index];
            //0
            Vector3        data = ((Vector3[])typeof(HMotionEyeNeckMale.EyeNeck).GetField(target).GetValue(enTmp))[0];
            TypedReference r    = __makeref(enTmp);

            GUILayout.BeginHorizontal(GUILayout.Width(uiLabelWidth * 3));
            GUILayout.Label($"{nameDict[target]}A");
            GUILayout.Label($"x{data.x}", GUILayout.Width(uiLabelWidth2));
            var x = GUILayout.HorizontalSlider(data.x, 0, 360, GUILayout.Width(uiSliderWidth));

            GUILayout.Label($"y{data.y}", GUILayout.Width(uiLabelWidth2));
            var y = GUILayout.HorizontalSlider(data.y, 0, 360, GUILayout.Width(uiSliderWidth));

            GUILayout.Label($"z{data.z}", GUILayout.Width(uiLabelWidth2));
            var z = GUILayout.HorizontalSlider(data.z, 0, 360, GUILayout.Width(uiSliderWidth));

            Vector3[] values = new Vector3[] { new Vector3(x, y, z), ((Vector3[])typeof(HMotionEyeNeckMale.EyeNeck).GetField(target).GetValue(enTmp))[1] };
            typeof(HMotionEyeNeckMale.EyeNeck).GetField(target).SetValueDirect(r, values);
            lst[index] = enTmp;
            GUILayout.Label("", GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();
            //1
            data = ((Vector3[])typeof(HMotionEyeNeckMale.EyeNeck).GetField(target).GetValue(enTmp))[1];
            r    = __makeref(enTmp);
            GUILayout.BeginHorizontal(GUILayout.Width(uiLabelWidth * 3));
            GUILayout.Label($"{nameDict[target]}B");
            GUILayout.Label($"x{data.x}", GUILayout.Width(uiLabelWidth2));
            x = GUILayout.HorizontalSlider(data.x, 0, 360, GUILayout.Width(uiSliderWidth));
            GUILayout.Label($"y{data.y}", GUILayout.Width(uiLabelWidth2));
            y = GUILayout.HorizontalSlider(data.y, 0, 360, GUILayout.Width(uiSliderWidth));
            GUILayout.Label($"z{data.z}", GUILayout.Width(uiLabelWidth2));
            z      = GUILayout.HorizontalSlider(data.z, 0, 360, GUILayout.Width(uiSliderWidth));
            values = new Vector3[] { ((Vector3[])typeof(HMotionEyeNeckMale.EyeNeck).GetField(target).GetValue(enTmp))[0], new Vector3(x, y, z) };
            typeof(HMotionEyeNeckMale.EyeNeck).GetField(target).SetValueDirect(r, values);
            lst[index] = enTmp;
            GUILayout.Label("", GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();
        }
        void GUIIntT(string target, int index)
        {
            enTmp = lst[index];
            GUILayout.BeginHorizontal(GUILayout.Width(uiLabelWidth));
            int data = (int)typeof(HMotionEyeNeckMale.EyeNeck).GetField(target).GetValue(enTmp);

            GUILayout.Label($"{nameDict[target]} {data}");
            TypedReference r = __makeref(enTmp);

            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                if (data > 0)
                {
                    typeof(HMotionEyeNeckMale.EyeNeck).GetField(target).SetValueDirect(r, data - 1);
                }
            }
            if (GUILayout.Button("+", GUILayout.Width(20)))
            {
                typeof(HMotionEyeNeckMale.EyeNeck).GetField(target).SetValueDirect(r, data + 1);
            }
            lst[index] = enTmp;
            GUILayout.Label("", GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();
        }
Esempio n. 6
0
    public bool Load(string _assetpath, string _file)
    {
        this.lstEyeNeck.Clear();
        if (_file == string.Empty)
        {
            return(false);
        }
        List <string> nameListFromPath = CommonLib.GetAssetBundleNameListFromPath(_assetpath, false);

        nameListFromPath.Sort();
        this.abName    = string.Empty;
        this.assetName = string.Empty;
        this.excelData = (ExcelData)null;
        this.info.Init();
        Vector3 zero = Vector3.get_zero();

        for (int index1 = 0; index1 < nameListFromPath.Count; ++index1)
        {
            this.abName    = nameListFromPath[index1];
            this.assetName = _file;
            if (GlobalMethod.AssetFileExist(this.abName, this.assetName, string.Empty))
            {
                this.excelData = CommonLib.LoadAsset <ExcelData>(this.abName, this.assetName, false, string.Empty);
                Singleton <HSceneManager> .Instance.hashUseAssetBundle.Add(this.abName);

                if (!Object.op_Equality((Object)this.excelData, (Object)null))
                {
                    int num1 = 3;
                    while (num1 < this.excelData.MaxCell)
                    {
                        this.row = this.excelData.list[num1++].list;
                        int num2 = 0;
                        this.info = new HMotionEyeNeckMale.EyeNeck();
                        this.info.Init();
                        if (this.row.Count != 0)
                        {
                            List <string> row1    = this.row;
                            int           index2  = num2;
                            int           num3    = index2 + 1;
                            string        element = row1.GetElement <string>(index2);
                            if (!element.IsNullOrEmpty())
                            {
                                this.info.anim = element;
                                ref HMotionEyeNeckMale.EyeNeck local1 = ref this.info;
                                List <string> row2   = this.row;
                                int           index3 = num3;
                                int           num4   = index3 + 1;
                                int           num5   = int.Parse(row2.GetElement <string>(index3));
                                local1.openEye = num5;
                                ref HMotionEyeNeckMale.EyeNeck local2 = ref this.info;
                                List <string> row3   = this.row;
                                int           index4 = num4;
                                int           num6   = index4 + 1;
                                int           num7   = int.Parse(row3.GetElement <string>(index4));
                                local2.openMouth = num7;
                                ref HMotionEyeNeckMale.EyeNeck local3 = ref this.info;
                                List <string> row4   = this.row;
                                int           index5 = num6;
                                int           num8   = index5 + 1;
                                int           num9   = int.Parse(row4.GetElement <string>(index5));
                                local3.eyebrow = num9;
                                ref HMotionEyeNeckMale.EyeNeck local4 = ref this.info;
                                List <string> row5   = this.row;
                                int           index6 = num8;
                                int           num10  = index6 + 1;
                                int           num11  = int.Parse(row5.GetElement <string>(index6));
                                local4.eye = num11;
                                ref HMotionEyeNeckMale.EyeNeck local5 = ref this.info;
                                List <string> row6   = this.row;
                                int           index7 = num10;
                                int           num12  = index7 + 1;
                                int           num13  = int.Parse(row6.GetElement <string>(index7));
                                local5.mouth = num13;
                                ref HMotionEyeNeckMale.EyeNeck local6 = ref this.info;
                                List <string> row7   = this.row;
                                int           index8 = num12;
                                int           num14  = index8 + 1;
                                int           num15  = int.Parse(row7.GetElement <string>(index8));
                                local6.Neckbehaviour = num15;
                                ref HMotionEyeNeckMale.EyeNeck local7 = ref this.info;
 //写入数据 - 普通int数据
 void SBAddData(StringBuilder sb, HMotionEyeNeckMale.EyeNeck neck, string fieldName)
 {
     sb.Append($"<{typeof(HMotionEyeNeckMale.EyeNeck).GetField(fieldName).GetValue(neck)}>");
 }