变色
begincode;
name:自定义材质-颜色;
1:if fun mech.raycast();
2: UIInput 数据1=fun ui.inputField(Vector3 0.2,0.4,0:Vector3 320,60,0:Color 255,255,255,255:String );
3: UILabel 红色=fun ui.text(Vector3 0.1,0.4,0:Float 32:Color 255,255,255,255:String 红色);
4: String 红=varf UIInput.数据1.读取文本();
5: Float 红值=varf String.红.转换为小数();
6: Float 红值换算=fun float.division(var 红值:Float 255);
7: UIInput 数据2=fun ui.inputField(Vector3 0.2,0.3,0:Vector3 320,60,0:Color 255,255,255,255:String );
8: UILabel 绿色=fun ui.text(Vector3 0.1,0.3,0:Float 32:Color 255,255,255,255:String 绿色);
9: String 绿=varf UIInput.数据2.读取文本();
10: Float 绿值=varf String.绿.转换为小数();
11: Float 绿值换算=fun float.division(var 绿值:Float 255);
12: UIInput 数据3=fun ui.inputField(Vector3 0.2,0.2,0:Vector3 320,60,0:Color 255,255,255,255:String );
13: UILabel 蓝色=fun ui.text(Vector3 0.1,0.2,0:Float 32:Color 255,255,255,255:String 蓝色);
14: String 蓝=varf UIInput.数据3.读取文本();
15: Float 蓝值=varf String.蓝.转换为小数();
16: Float 蓝值换算=fun float.division(var 蓝值:Float 255);
17: Vector3 颜色值=fun creatVariable.Vector3(var 红值换算:var 绿值换算:var 蓝值换算);
18: Color 颜色1=varf Vector3.颜色值.转换为颜色();
19: UIInput 金属度=fun ui.inputField(Vector3 0.2,0.6,0:Vector3 160,60,0:Color 255,255,255,255:String );
20: UILabel 金属:=fun ui.text(Vector3 0.1,0.6,0:Float 32:Color 255,255,255,255:String 金属:);
21: String 金属=varf UIInput.金属度.读取文本();
22: Float 金属值=varf String.金属.转换为小数();
23: UIInput 光泽度=fun ui.inputField(Vector3 0.2,0.5,0:Vector3 160,60,0:Color 255,255,255,255:String );
24: UILabel 光泽;=fun ui.text(Vector3 0.1,0.5,0:Float 32:Color 255,255,255,255:String 光泽:);
25: String 光泽=varf UIInput.光泽度.读取文本();
26: Float 光泽值=varf String.光泽.转换为小数();
27: Device 零件=fun mech.focusDevice();
28:UIButton 变色=fun ui.button(Vector3 0.8,0.2,0:Vector3 100,100,0:Color 255,255,255,255:String 变色:Float 50:Float 4);
29:if varf UIButton.变色.是否按下瞬间();
30: if fun mech.deviceNotNull(var 零件);
31: =dvf 零件.Device.setColor(var 颜色1);
32: =dvf 零件.Device.setMetalic(var 金属值);
33: =dvf 零件.Device.setGlossiness(var 光泽值);
34:UIButton 还原=fun ui.button(Vector3 0.8,0.3,0:Vector3 100,100,0:Color 255,255,255,255:String 还原:Float 50:Float 4);
35:if varf UIButton.还原.是否按下瞬间();
36: =dvf 零件.Device.clearMat();
endcode