Example #1
0
        void Awake()
        {
            //Instantiate path finder dynamically
            switch (PathFindingType)
            {
            case PathFinderType.AStar:
            {
                this.pathFinder = new Ants.Pathfinding.AStarPathFinder();

                break;
            }

            default:
            {
                throw new System.Exception("Invalid type.");
            }
            }

            //Discover sprite material
            this.defaultSpriteMaterial = new UnityEngine.Material(UnityEngine.Shader.Find("Sprites/Default"));
            if (this.defaultSpriteMaterial == null)
            {
                throw new System.Exception("Failed to discover default sprite shader.");
            }

            //Instantiate the line renderer dynamically and attach as child to this ojject
            var gameObj = new UnityEngine.GameObject("Path Renderer");

            gameObj.transform.parent        = transform;
            gameObj.transform.localPosition = new UnityEngine.Vector3(0.0f, 0.0f, 0.0f);
            this.pathlineRenderer           = gameObj.AddComponent <UnityEngine.LineRenderer>();

            this.pathlineRenderer.startColor     = new UnityEngine.Color(0.0f, 0.0f, 1.0f, 0.75f);
            this.pathlineRenderer.endColor       = this.pathlineRenderer.startColor * new UnityEngine.Color(0.75f, 0.75f, 0.75f, 1.0f);
            this.pathlineRenderer.startWidth     = 0.1f;
            this.pathlineRenderer.endWidth       = this.pathlineRenderer.startWidth;
            this.pathlineRenderer.sharedMaterial = this.defaultSpriteMaterial;
        }
Example #2
0
        static int _m_SetMaterial(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                PathTestProject.CubeScripts gen_to_be_invoked = (PathTestProject.CubeScripts)translator.FastGetCSObj(L, 1);



                {
                    UnityEngine.Material _mat = (UnityEngine.Material)translator.GetObject(L, 2, typeof(UnityEngine.Material));

                    gen_to_be_invoked.SetMaterial(_mat);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _m_GetModifiedMaterial(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.UI.Mask __cl_gen_to_be_invoked = (UnityEngine.UI.Mask)translator.FastGetCSObj(L, 1);


            try {
                {
                    UnityEngine.Material baseMaterial = (UnityEngine.Material)translator.GetObject(L, 2, typeof(UnityEngine.Material));

                    UnityEngine.Material __cl_gen_ret = __cl_gen_to_be_invoked.GetModifiedMaterial(baseMaterial);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Example #4
0
        static int _m_GetPopMaterial(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.CanvasRenderer __cl_gen_to_be_invoked = (UnityEngine.CanvasRenderer)translator.FastGetCSObj(L, 1);


            try {
                {
                    int index = LuaAPI.xlua_tointeger(L, 2);

                    UnityEngine.Material __cl_gen_ret = __cl_gen_to_be_invoked.GetPopMaterial(index);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Example #5
0
        static int _m_SetPopMaterial(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.CanvasRenderer __cl_gen_to_be_invoked = (UnityEngine.CanvasRenderer)translator.FastGetCSObj(L, 1);


            try {
                {
                    UnityEngine.Material material = (UnityEngine.Material)translator.GetObject(L, 2, typeof(UnityEngine.Material));
                    int index = LuaAPI.xlua_tointeger(L, 3);

                    __cl_gen_to_be_invoked.SetPopMaterial(material, index);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Example #6
0
        static int _m_Apply_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.Material _mat = (UnityEngine.Material)translator.GetObject(L, 1, typeof(UnityEngine.Material));
                    FairyGUI.BlendMode   _blendMode; translator.Get(L, 2, out _blendMode);

                    FairyGUI.BlendModeUtils.Apply(
                        _mat,
                        _blendMode);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Example #7
0
        static StackObject *Blit_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Material @mat = (UnityEngine.Material) typeof(UnityEngine.Material).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.RenderTexture @dest = (UnityEngine.RenderTexture) typeof(UnityEngine.RenderTexture).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.Texture @source = (UnityEngine.Texture) typeof(UnityEngine.Texture).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            UnityEngine.Graphics.Blit(@source, @dest, @mat);

            return(__ret);
        }
Example #8
0
        static StackObject *DrawGUITexture_34(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Material @mat = (UnityEngine.Material) typeof(UnityEngine.Material).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Texture @texture = (UnityEngine.Texture) typeof(UnityEngine.Texture).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.Rect @screenRect = (UnityEngine.Rect) typeof(UnityEngine.Rect).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            UnityEngine.Gizmos.DrawGUITexture(@screenRect, @texture, @mat);

            return(__ret);
        }
Example #9
0
        static int _m_GetMaterial(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.CanvasRenderer __cl_gen_to_be_invoked = (UnityEngine.CanvasRenderer)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 1)
                {
                    UnityEngine.Material __cl_gen_ret = __cl_gen_to_be_invoked.GetMaterial(  );
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
                {
                    int index = LuaAPI.xlua_tointeger(L, 2);

                    UnityEngine.Material __cl_gen_ret = __cl_gen_to_be_invoked.GetMaterial(index);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.CanvasRenderer.GetMaterial!"));
        }
        /// <inheritdoc />
        public virtual void ApplyMaterialPatch(Material material, MWMaterial patch)
        {
            if (patch.Color != null)
            {
                material.color = material.color.ToMWColor().ApplyPatch(patch.Color).ToColor();
            }

            if (patch.MainTextureOffset != null)
            {
                material.mainTextureOffset = material.mainTextureOffset.ToMWVector2().ApplyPatch(patch.MainTextureOffset).ToVector2();
            }
            if (patch.MainTextureScale != null)
            {
                material.mainTextureScale = material.mainTextureScale.ToMWVector2().ApplyPatch(patch.MainTextureScale).ToVector2();
            }
            if (patch.MainTextureId != null)
            {
                var textureId = patch.MainTextureId.Value;
                textureAssignments[material.GetInstanceID()] = textureId;
                if (patch.MainTextureId == Guid.Empty)
                {
                    material.mainTexture = null;
                }
                else
                {
                    MREAPI.AppsAPI.AssetCache.OnCached(textureId, tex =>
                    {
                        if (!material || textureAssignments[material.GetInstanceID()] != textureId)
                        {
                            return;
                        }
                        material.mainTexture = (Texture)tex;
                    });
                }
            }
        }
Example #11
0
        public static int GetDataHashCode(this UnityEngine.Material material)
        {
            string longName = material.name.Replace(" (Instance)", "") +
                              material.color.r +
                              material.color.g +
                              material.color.b +
                              material.color.a;

            if (material.mainTexture != null)
            {
                longName += material.mainTexture.name +
                            material.mainTextureOffset +
                            material.mainTextureScale;
            }

            if (material.shader != null)
            {
                longName += material.shader.name +
                            material.shader.renderQueue;
            }

            // Send it back!
            return(longName.GetHashCode());
        }
        static StackObject *GetModifiedMaterial_6(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Material @baseMaterial = (UnityEngine.Material) typeof(UnityEngine.Material).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.UI.Mask instance_of_this_method = (UnityEngine.UI.Mask) typeof(UnityEngine.UI.Mask).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetModifiedMaterial(@baseMaterial);

            object obj_result_of_this_method = result_of_this_method;

            if (obj_result_of_this_method is CrossBindingAdaptorType)
            {
                return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance));
            }
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Example #13
0
        static int _m_ApplyAlphaMaskProperties(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                FairyGUI.UpdateContext gen_to_be_invoked = (FairyGUI.UpdateContext)translator.FastGetCSObj(L, 1);



                {
                    UnityEngine.Material _mat = (UnityEngine.Material)translator.GetObject(L, 2, typeof(UnityEngine.Material));
                    bool _erasing             = LuaAPI.lua_toboolean(L, 3);

                    gen_to_be_invoked.ApplyAlphaMaskProperties(_mat, _erasing);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Example #14
0
        static int _m_GetModifiedMaterial(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                TMPro.TextMeshProUGUI gen_to_be_invoked = (TMPro.TextMeshProUGUI)translator.FastGetCSObj(L, 1);



                {
                    UnityEngine.Material _baseMaterial = (UnityEngine.Material)translator.GetObject(L, 2, typeof(UnityEngine.Material));

                    UnityEngine.Material gen_ret = gen_to_be_invoked.GetModifiedMaterial(_baseMaterial);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static StackObject *Add_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 5);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Rendering.ColorWriteMask @colorWriteMask = (UnityEngine.Rendering.ColorWriteMask) typeof(UnityEngine.Rendering.ColorWriteMask).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Rendering.CompareFunction @compareFunction = (UnityEngine.Rendering.CompareFunction) typeof(UnityEngine.Rendering.CompareFunction).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.Rendering.StencilOp @operation = (UnityEngine.Rendering.StencilOp) typeof(UnityEngine.Rendering.StencilOp).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            System.Int32 @stencilID = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 5);
            UnityEngine.Material @baseMat = (UnityEngine.Material) typeof(UnityEngine.Material).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = UnityEngine.UI.StencilMaterial.Add(@baseMat, @stencilID, @operation, @compareFunction, @colorWriteMask);

            object obj_result_of_this_method = result_of_this_method;

            if (obj_result_of_this_method is CrossBindingAdaptorType)
            {
                return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance));
            }
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
        public static void Populate()
        {
            List <RecipeDef>    list  = DefDatabase <RecipeDef> .AllDefsListForReading;
            List <WorkGiverDef> gList = DefDatabase <WorkGiverDef> .AllDefsListForReading;

            UnityEngine.Material mat = DesignationDefOf.Uninstall.iconMat;

            foreach (var rec in list.Where(x => x.AllRecipeUsers?.OfType <BuildableDef>().Any() == true &&
                                           x.ingredients?.Count() == 1 &&
                                           x.ingredients[0]?.filter?.AnyAllowedDef?.stackLimit < 2 &&
                                           x.fixedIngredientFilter?.AllowedThingDefs != null))
            {
                foreach (var rUser in rec.AllRecipeUsers.Where(y => y is BuildableDef))
                {
                    IEnumerable <WorkGiverDef> gListSel = gList.Where(x => x.fixedBillGiverDefs?.Contains(rUser) == true &&
                                                                      (x.giverClass == typeof(WorkGiver_DoBill) || x.giverClass.IsSubclassOf(typeof(WorkGiver_DoBill))));

                    if (gListSel == null)
                    {
                        continue;
                    }

                    WorkGiverDef wGiverDef = gListSel.FirstOrDefault();

                    if (wGiverDef == null)
                    {
                        continue;
                    }

                    DesignationDef dDef = DefDatabase <DesignationDef> .AllDefsListForReading.FirstOrDefault(x => x.defName == rec.defName + "Designation");

                    if (dDef == null)
                    {
                        dDef = new DesignationDef()
                        {
                            defName    = rec.defName + "Designation",
                            iconMat    = MaterialPool.MatFrom("Designations/General", ShaderDatabase.MetaOverlay),
                            targetType = TargetType.Thing
                        };

                        DefDatabase <DesignationDef> .Add(dDef);
                    }

                    foreach (var def in rec.fixedIngredientFilter.AllowedThingDefs)
                    {
                        if (def.comps != null)
                        {
                            def.comps.Add(new CompProperties_ApplicableDesignation()
                            {
                                designationDef = dDef
                            });
                        }
                    }

                    string wgname = $"{wGiverDef.defName}_{rec.defName}_DesignationWorkGiver";

                    WorkGiverDef wgDef = null;
                    gListSel = gList.Where(x => x.defName == wgname);

                    if (gListSel != null)
                    {
                        wgDef = gListSel.FirstOrDefault();
                    }

                    if (wgDef == null && wGiverDef.workType != null && wGiverDef.requiredCapacities != null)
                    {
                        JobDef jDef = JobDefOf.DoBill;

                        if (wGiverDef.giverClass != typeof(WorkGiver_DoBill))
                        {
                            RecipeJobDef rj = DefDatabase <RecipeJobDef> .AllDefsListForReading.FirstOrDefault(x => x.defName == rec.defName);

                            if (rj == null)
                            {
                                rj = DefDatabase <RecipeJobDef> .AllDefsListForReading.FirstOrDefault(x => x.workerClass == rec.workerClass);
                            }

                            if (rj == null)
                            {
                                Log.Message($"Couldn't find a proper RecipeJobDef for redefined DoBill task {wGiverDef.defName}");
                                continue;
                            }

                            jDef = DefDatabase <JobDef> .AllDefsListForReading.FirstOrDefault(x => x.defName == rj.jobName);

                            if (jDef == null)
                            {
                                Log.Message($"Couldn't find a JobDef({rj.jobName}) for RecipeJobDef({rj.defName})");
                                continue;
                            }
                        }
                        wgDef = new MicroWorkGiverDef()
                        {
                            workGiverDef       = wGiverDef,
                            recipeDef          = rec,
                            designationDef     = dDef,
                            defName            = wgname,
                            label              = wGiverDef.label,
                            giverClass         = typeof(WorkGiver_MicroRecipe),
                            jobDef             = jDef,
                            workType           = wGiverDef.workType,
                            priorityInType     = wGiverDef.priorityInType - 5,
                            verb               = wGiverDef.verb,
                            gerund             = wGiverDef.verb,
                            requiredCapacities = new List <PawnCapacityDef>(wGiverDef.requiredCapacities),
                            prioritizeSustains = wGiverDef.prioritizeSustains
                        };
                        DefDatabase <WorkGiverDef> .Add(wgDef);

                        wgDef.workType.workGiversByPriority.Add(wgDef);
                    }
                }
            }
        }
Example #17
0
        private static IEnumerator ResolveMaterialTexture(string id)
        {
            Common.Models.Material mat = GetMaterial(id);
            if (mat == null)
            {
                UnityEngine.Debug.Log($"MATERIAL {id} DOES NOT EXIST");
                _totalCalls--;
                yield return(null);

                yield break;
            }

            string url = $"{_ModelServerURL}/api/material/{mat.Id}";

            UnityEngine.Texture materialTexture = null;

            UnityEngine.Debug.Log(url);
            using (UnityWebRequest webRequest = UnityWebRequestTexture.GetTexture(url))
            {
                yield return(webRequest.SendWebRequest());

                if (webRequest.isNetworkError)
                {
                    UnityEngine.Debug.Log("Error: " + webRequest.error);
                    yield return(null);

                    _totalCalls--;
                    yield break;
                }
                else if (webRequest.isHttpError)
                {
                    // UnityEngine.Debug.Log("Error: " + webRequest.error);
                    yield return(null);

                    _totalCalls--;
                    yield break;
                }
                else
                {
                    materialTexture = ((DownloadHandlerTexture)webRequest.downloadHandler).texture;
                }
            }

            if (materialTexture != null)
            {
                UnityEngine.Material baseMaterial = LookupMaterial(mat.Id);

                UnityEngine.Material newMaterial = new UnityEngine.Material(baseMaterial.shader);

                newMaterial.CopyPropertiesFromMaterial(baseMaterial);

                newMaterial.name        = mat.Name + " (With Texture)";
                newMaterial.mainTexture = materialTexture;
                newMaterial.color       = new UnityEngine.Color(
                    220f / 255f,
                    220f / 255f,
                    220f / 255f
                    );
                newMaterial.SetFloat("_Metallic", (float)mat.Shininess / byte.MaxValue);
                newMaterial.SetFloat("_Smoothness", (float)mat.Smoothness / byte.MaxValue);

                matLib.Add("_" + id, newMaterial);

                UnityEngine.Debug.Log(JsonConvert.SerializeObject(mat));

                // UnityEngine.GameObject.Find("Test").GetComponent<UnityEngine.MeshRenderer>().material = newMaterial;
            }

            _totalCalls--;
        }
Example #18
0
 public abstract bool UpdateMaterial(UnityEngine.Material material);
Example #19
0
 public UnityMaterial(Shader shader) : base(shader)
 {
     material           = new UnityEngine.Material((UnityShader)shader);
     material.hideFlags = UnityEngine.HideFlags.HideAndDontSave ^ UnityEngine.HideFlags.DontSaveInBuild;
 }
Example #20
0
 public static void DrawTexture(UnityEngine.Rect screenRect, UnityEngine.Texture texture, UnityEngine.Material mat)
 {
 }
Example #21
0
 public NoiseInfo(string tileCode, bool isAttack, UnityEngine.Material uiColor)
 {
     this.tileCode = tileCode;
     this.isAttack = isAttack;
     this.uiColor  = uiColor;
 }
Example #22
0
 public static void SetCubeMaterialColor(byte r, byte g, byte b, string unityObjectName)
 {
     UnityEngine.GameObject go  = UnityEngine.GameObject.Find(unityObjectName);
     UnityEngine.Material   mat = go.GetComponent <XamlConnection>().material;
     mat.color = new UnityEngine.Color32(r, g, b, 255);
 }
Example #23
0
 public static void DrawPreviewTexture(UnityEngine.Rect position, UnityEngine.Texture image, UnityEngine.Material mat)
 {
     UnityEditor.EditorGUI.DrawPreviewTexture(position, image, mat);
 }
Example #24
0
 public static void DrawPreviewTexture(UnityEngine.Rect position, UnityEngine.Texture image, UnityEngine.Material mat, UnityEngine.ScaleMode scaleMode, float imageAspect)
 {
     UnityEditor.EditorGUI.DrawPreviewTexture(position, image, mat, scaleMode, imageAspect);
 }
Example #25
0
        /** constructor
         */
        public MaterialItem(UnityEngine.Material a_material_raw, string[] a_property_list)
        {
            //property_list
            this.property_list = a_property_list;

            //material
            this.material = a_material_raw;

            //プロパティ初期化。
            for (int ii = 0; ii < this.property_list.Length; ii++)
            {
                switch (this.property_list[ii])
                {
                case "clip_flag":
                {
                    this.clip_flag.Initialize(this.material, this.property_list[ii]);
                } break;

                case "clip_x1":
                {
                    this.clip_x1.Initialize(this.material, this.property_list[ii]);
                } break;

                case "clip_y1":
                {
                    this.clip_y1.Initialize(this.material, this.property_list[ii]);
                } break;

                case "clip_x2":
                {
                    this.clip_x2.Initialize(this.material, this.property_list[ii]);
                } break;

                case "clip_y2":
                {
                    this.clip_y2.Initialize(this.material, this.property_list[ii]);
                } break;

                case "corner_size":
                {
                    this.corner_size.Initialize(this.material, this.property_list[ii]);
                } break;

                case "texture_x":
                {
                    this.texture_x.Initialize(this.material, this.property_list[ii]);
                } break;

                case "texture_y":
                {
                    this.texture_y.Initialize(this.material, this.property_list[ii]);
                } break;

                case "texture_w":
                {
                    this.texture_w.Initialize(this.material, this.property_list[ii]);
                } break;

                case "texture_h":
                {
                    this.texture_h.Initialize(this.material, this.property_list[ii]);
                } break;

                case "rect_w":
                {
                    this.rect_w.Initialize(this.material, this.property_list[ii]);
                } break;

                case "rect_h":
                {
                    this.rect_h.Initialize(this.material, this.property_list[ii]);
                } break;

                case "_MainTex":
                {
                    this.main_texture.Initialize(this.material, this.property_list[ii]);
                } break;

                default:
                {
                    Tool.Log("Material_Item", this.material.name + " : " + this.property_list[ii]);
                } break;
                }
            }
        }
Example #26
0
 /** 削除。
  */
 public void DestroyImmediate()
 {
     UnityEngine.GameObject.DestroyImmediate(this.material);
     this.material = null;
 }
Example #27
0
 public static IMaterial ToUniject(this UnityEngine.Material m)
 {
     return(new UnityMaterial(m));
 }
Example #28
0
 public void Test(UnityEngine.Material material)
 {
     material.SetFloat("t{caret}est", 10.0f);
 }
Example #29
0
        /** constructor
         */
        public Material_Item(UnityEngine.Material a_material_raw, Fee.Material.Status a_material_status, bool a_duplicate)
        {
            //material_status
            this.material_status = a_material_status;

            //material
            if (a_duplicate == true)
            {
                //複製。
                this.material = new UnityEngine.Material(a_material_raw);
            }
            else
            {
                //参照。
                this.material = a_material_raw;
            }

            //プロパティ初期化。
            string[] t_property_list = this.material_status.property_list;
            for (int ii = 0; ii < t_property_list.Length; ii++)
            {
                switch (t_property_list[ii])
                {
                case "clip_flag":
                {
                    this.clip_flag.Initialize(this.material, t_property_list[ii]);
                } break;

                case "clip_x1":
                {
                    this.clip_x1.Initialize(this.material, t_property_list[ii]);
                } break;

                case "clip_y1":
                {
                    this.clip_y1.Initialize(this.material, t_property_list[ii]);
                } break;

                case "clip_x2":
                {
                    this.clip_x2.Initialize(this.material, t_property_list[ii]);
                } break;

                case "clip_y2":
                {
                    this.clip_y2.Initialize(this.material, t_property_list[ii]);
                } break;

                case "corner_size":
                {
                    this.corner_size.Initialize(this.material, t_property_list[ii]);
                } break;

                case "texture_x":
                {
                    this.texture_x.Initialize(this.material, t_property_list[ii]);
                } break;

                case "texture_y":
                {
                    this.texture_y.Initialize(this.material, t_property_list[ii]);
                } break;

                case "texture_w":
                {
                    this.texture_w.Initialize(this.material, t_property_list[ii]);
                } break;

                case "texture_h":
                {
                    this.texture_h.Initialize(this.material, t_property_list[ii]);
                } break;

                case "rect_w":
                {
                    this.rect_w.Initialize(this.material, t_property_list[ii]);
                } break;

                case "rect_h":
                {
                    this.rect_h.Initialize(this.material, t_property_list[ii]);
                } break;

                case "_MainTex":
                {
                    this.main_texture.Initialize(this.material, t_property_list[ii]);
                } break;

                default:
                {
                    Tool.Log("Material_Item", this.material.name + " : " + t_property_list[ii]);
                } break;
                }
            }
        }
        private void MaterialFieldOnChange(UnityEngine.Material material)
        {
            var dbMaterial = new MaterialConverter(material).GetDbMaterial();

            //dbMaterial
        }