void OnEnable() { this.minSize = new Vector2(350, 250); so = new SerializedObject(ShapesConfig.Instance); useHdrColorPickers = so.FindProperty("useHdrColorPickers"); autoConfigureRenderPipeline = so.FindProperty("autoConfigureRenderPipeline"); useImmediateModeInstancing = so.FindProperty("useImmediateModeInstancing"); pushPopStateInDrawCommands = so.FindProperty("pushPopStateInDrawCommands"); polylineDefaultPointsPerTurn = so.FindProperty("polylineDefaultPointsPerTurn"); polylineBezierAngularSumAccuracy = so.FindProperty("polylineBezierAngularSumAccuracy"); sphereDetail = so.FindProperty("sphereDetail"); torusDivsMinorMajor = so.FindProperty("torusDivsMinorMajor"); coneDivs = so.FindProperty("coneDivs"); cylinderDivs = so.FindProperty("cylinderDivs"); capsuleDivs = so.FindProperty("capsuleDivs"); boundsSizeQuad = so.FindProperty("boundsSizeQuad"); boundsSizeTriangle = so.FindProperty("boundsSizeTriangle"); boundsSizeSphere = so.FindProperty("boundsSizeSphere"); boundsSizeTorus = so.FindProperty("boundsSizeTorus"); boundsSizeCuboid = so.FindProperty("boundsSizeCuboid"); boundsSizeCone = so.FindProperty("boundsSizeCone"); boundsSizeCylinder = so.FindProperty("boundsSizeCylinder"); boundsSizeCapsule = so.FindProperty("boundsSizeCapsule"); FRAG_OUTPUT_V4 = so.FindProperty("FRAG_OUTPUT_V4"); LOCAL_ANTI_ALIASING_QUALITY = so.FindProperty("LOCAL_ANTI_ALIASING_QUALITY"); QUAD_INTERPOLATION_QUALITY = so.FindProperty("QUAD_INTERPOLATION_QUALITY"); NOOTS_ACROSS_SCREEN = so.FindProperty("NOOTS_ACROSS_SCREEN"); #if SHAPES_URP urpRenderers = UnityInfo.LoadAllURPRenderData(); #endif }
//public void JsonParsing(string FileName="PlayerJsonData") //{ // //JsonData jsonUnit = FileDataManager.Instance.JsonFileLoad(FileName); // //여기서 파싱 테스트 함 // JsonData jsonUnitydata; // LoadJson(out jsonUnitydata, UnitData); // string TempID = jsonUnit["PlayerInfo"]["SelectDek"][3]["item-id"].ToString(); // print(TempID); //} ////UnitData 파싱 //public void JsonParsingUnit() //{ // string FileName = "UnitData"; // JsonData jsonUnit = FileDataManager.Instance.JsonFileLoad(FileName); // //여기서 파싱 테스트 함 // int num = jsonUnit.Count; //11 // //string TempID = jsonUnit["PlayerInfo"]["SelectDek"][3]["item-id"].ToString(); // for (int i = 0; i < jsonUnit.Count; i++) // { // // {"ID":0,"Name":"Ice Gollum ","ATK_Type":"Top","Kinds":"Unit","Coin":300, // // "Jew":10,"Elixir":2,"HP":400,"Speed":"Slow","Attack":4,"Atk_Zone":100,"BuildTime":1, // //"Sp_atk":4,"Up_Hp":10,"Up_atk":10,"Life":0,"EA":1}, // UnityInfo unit = new UnityInfo(); // unit.Id = i; // unit.Name = jsonUnit[i]["Name"].ToString(); // unit.Atk_Type = jsonUnit[i]["ATK_Type"].ToString(); //유닛타입 지상,공중 // unit.Kinds = jsonUnit[i]["Kinds"].ToString(); // unit.Coin = (int)jsonUnit[i]["Coin"]; // unit.Jew = (int)jsonUnit[i]["Jew"]; // unit.HP = (int)jsonUnit[i]["HP"]; // unit.Speed = (int)jsonUnit[i]["Speed"]; // unit.Attack =(int)jsonUnit[i]["Attack"]; // unit.Atk_Zone = (int)jsonUnit[i]["Atk_Zone"]; // unit.Build = (int)jsonUnit[i]["BuildTime"]; // unit.Life = (int)jsonUnit[i]["Life"]; // unit.Up_atk = (int)jsonUnit[i]["Up_atk"]; // unit.SpawnEA = (int)jsonUnit[i]["EA"]; // //파일의 내용을 딕셔너리에 저장한다. // dicUnityData.Add(i,unit); // } //} // 아이템 추가. public void AddItem(UnityInfo _cInfo) { // 아이템은 고유해야 되니까, 먼저 체크! if (dicUnityData.ContainsKey(_cInfo.Id)) { return; } // 이제 아이템을 추가. dicUnityData.Add(_cInfo.Id, _cInfo); }
/// <summary> /// Starts eiter a client or a server - depending on if headless or not. /// </summary> private void Start() { Debug.LogFormat("[GameNetwork] Starting Client or Server? {0}", Version); if (UnityInfo.IsHeadless()) { Debug.Log("[GameNetwork] Starting Server"); GameServer.Start(this); } else { Debug.Log("[GameNetwork] Starting Client"); GameClient.Start(this, Environment.GetCommandLineArgs()); } }
private bool AutoFixIsUsingDefaultUIShader() { if (UnityInfo.Version_2020_3_Or_Newer()) { return(false); } if (target.DefaultUIMaterial == null) { return(false); } target.GetComponentsInChildren(_tmpGraphics); foreach (var graphic in _tmpGraphics) { if (AutoFixIsExceptionCaseForDefaultUIShader(graphic)) { continue; } Material mat = graphic.material; if (mat == null) { return(true); } Shader shader = mat.shader; if (shader == null) { continue; } if (shader.name == DEFAULT_UI_NAME) { return(true); } } return(false); }
void AdvancedSettings() { using (ShapesUI.Group) { GUILayout.Label("Advanced", EditorStyles.boldLabel); if (ShapesUI.CenteredButton(new GUIContent("Regenerate Shaders & Materials", "Generates all shaders and materials in Shapes"))) { CodegenShaders.GenerateShadersAndMaterials(UnityInfo.GetCurrentRenderPipelineInUse()); } if (ShapesUI.CenteredButton(new GUIContent("Regenerate Draw Overloads", "Regenerates all Draw.X overload functions to DrawOverloads.cs"))) { CodegenDrawOverloads.GenerateDrawOverloadsScript(); } if (ShapesUI.CenteredButton(new GUIContent("Regenerate Component Interfaces", "Regenerates all Shape component interfaces"))) { CodegenInterfaces.Generate(); } if (ShapesUI.CenteredButton(new GUIContent("Regenerate IM meta MPBs", "Regenerates all meta-material property blocks for each shape, based on their shader parameters in the core.cginc files"))) { CodegenMpbs.Generate(); } } }
//파일메니저에서 할일 파일 경로에 있는 파일을 있나 없나 파악하고 있다면 실행하고 없다면 에러를 발생시킨다. //각기 다른 파일을 관리할수 있도록 한다. //파싱할수 있도록 한다. //public JsonData JsonFileLoad(string FileName ) // { // string defaultPath = "/Resources/Data/"+FileName+".json"; // JsonData jsondata = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + defaultPath)); // return jsondata; // } //UnityInfo 게임에서 사용되는 유닛카드의 정보 public void ParsingFirstUnitData() { //JsonData는 내부에 설정 JsonData jsonUnitydata; LoadJson(out jsonUnitydata, UnitData); //JsonData jsonUnitydata = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/Resources/Data/UnitData.json")); for (int i = 0; i < jsonUnitydata.Count; i++) { // {"ID":0,"Name":"Ice Gollum ","ATK_Type":"Top","Kinds":"Unit","Coin":300, // "Jew":10,"Elixir":2,"HP":400,"Speed":"Slow","Attack":4,"Atk_Zone":100,"BuildTime":1, //"Sp_atk":4,"Up_Hp":10,"Up_atk":10,"Life":0,"EA":1}, UnityInfo unit = new UnityInfo(); //유닛의 고유ID 와 맞출려고 +1함 unit.Id = (int)jsonUnitydata[i]["ID"]; unit.Name = jsonUnitydata[i]["Name"].ToString(); unit.Atk_Type = jsonUnitydata[i]["ATK_Type"].ToString(); //유닛타입 지상,공중 unit.Kinds = jsonUnitydata[i]["Kinds"].ToString(); unit.Coin = (int)jsonUnitydata[i]["Coin"]; unit.Jew = (int)jsonUnitydata[i]["Jew"]; unit.HP = (int)jsonUnitydata[i]["HP"]; unit.Speed = (int)jsonUnitydata[i]["Speed"]; unit.Attack = (int)jsonUnitydata[i]["Attack"]; unit.Atk_Zone = (int)jsonUnitydata[i]["Atk_Zone"]; unit.Build = (int)jsonUnitydata[i]["BuildTime"]; unit.Life = (int)jsonUnitydata[i]["Life"]; unit.Up_atk = (int)jsonUnitydata[i]["Up_atk"]; unit.Up_Hp = (int)jsonUnitydata[i]["Up_Hp"]; unit.SpawnEA = (int)jsonUnitydata[i]["EA"]; unit.Elixir = (int)jsonUnitydata[i]["Elixir"]; unit.SpAble = jsonUnitydata[i]["SpAble"].ToString(); //파일의 내용을 딕셔너리에 저장한다. GameData.Instance.UnityDatas.Add(unit); GameData.Instance.infoCards = GameData.Instance.UnityDatas.Count; } }
void RenderPipeSettings() { using (ShapesUI.Group) { GUILayout.Label("Render Pipeline", EditorStyles.boldLabel); //EditorGUILayout.HelpBox( "Unity's render pipeline landscape is a little messy, so you can use this section to sanity check that everything has been compiled correctly, as well as force-compile to a specific render pipeline", MessageType.Info ); // detect all states RenderPipeline rp = UnityInfo.GetCurrentRenderPipelineInUse(); RenderPipeline rpShaders = ShapesImportState.Instance.currentShaderRP; RenderPipeline?rpKeywords = ShapesImportState.TryGetPreprocessorRP(out RenderPipeline rpkw) ? rpkw : (RenderPipeline?)null; void RpSection(string desc, RenderPipeline pipe) { using (ShapesUI.Horizontal) { GUILayout.Label(desc, GUILayout.Width(240)); GUILayout.Label("[" + pipe.ShortName() + "]", GUILayout.ExpandWidth(false)); } } EditorGUILayout.BeginVertical(EditorStyles.helpBox); // detected RP in Unity RpSection("Shapes detected you seem to be using:", rp); // shaders RpSection("Shapes shaders were last compiled for:", rpShaders); if (rpShaders != rp) { EditorGUILayout.HelpBox("Shaders seem to be compiled to a different render pipeline. You might want to force-set to your render pipeline below", MessageType.Warning); } // keywords if (rpKeywords.HasValue) { RpSection("Preprocessor keywords defined for:", rpKeywords.Value); if (rpKeywords != rp) { EditorGUILayout.HelpBox("Preprocessor keywords seem to be defined for a different render pipeline. You might want to force-set to your render pipeline below", MessageType.Warning); } } else { EditorGUILayout.HelpBox("Keywords are currently in a mixed state. Please force-set to your render pipeline below", MessageType.Error); } // Render Feature check #if SHAPES_URP EditorGUILayout.Space(8); GUILayout.Label("URP renderers detected:", EditorStyles.boldLabel); foreach (URP_RND_DATA data in urpRenderers) { EditorGUILayout.ObjectField(GUIContent.none, data, typeof(URP_RND_DATA), false /*, GUILayout.Width( 120 )*/); bool hasShapesRenderer = data.rendererFeatures.Any(x => x.GetType() == typeof(ShapesRenderFeature)); if (hasShapesRenderer) { EditorGUILayout.HelpBox("✔ Immediate mode ready", MessageType.None); } else { EditorGUILayout.HelpBox($"{data.name} is missing a ShapesRenderFeature.\nImmediate mode drawing will not be supported unless you select this object and add the ShapesRenderFeature to it", MessageType.Error); } EditorGUILayout.Space(8); } #endif EditorGUILayout.EndVertical(); GUILayout.Space(10); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.PropertyField(autoConfigureRenderPipeline, new GUIContent("Auto-configure RP")); using (new EditorGUI.DisabledScope(autoConfigureRenderPipeline.boolValue)) { GUILayout.Label("Force-set Shapes to:", EditorStyles.boldLabel); using (ShapesUI.Horizontal) { for (int i = 0; i < 3; i++) { RenderPipeline rpIter = (RenderPipeline)i; if (GUILayout.Button(rpIter.ShortName())) { ShapesImportState.ForceSetRP(rpIter); } } } } EditorGUILayout.EndVertical(); } }
public static void GenerateShadersAndMaterials() { RenderPipeline currentRP = UnityInfo.GetCurrentRenderPipelineInUse(); int blendModeCount = System.Enum.GetNames(typeof(ShapesBlendMode)).Length; const string CORE_SUFFIX = " Core"; IEnumerable <TextAsset> shaderCores = ShapesIO.LoadAllAssets <TextAsset>(ShapesIO.CoreShaderFolder); IEnumerable <string> shaderNames = shaderCores.Select(x => x.name.Substring(0, x.name.Length - CORE_SUFFIX.Length)); // generate all shaders foreach (string name in shaderNames) { for (int i = 0; i < blendModeCount; i++) { ShapesBlendMode blendMode = (ShapesBlendMode)i; string path = $"{ShapesIO.GeneratedShadersFolder}/{name} {blendMode}.shader"; string shaderContents = new ShaderBuilder(name, blendMode, currentRP).shader; File.WriteAllText(path, shaderContents); } } // update the current shader state ShapesImportState.Instance.currentShaderRP = currentRP; EditorUtility.SetDirty(ShapesImportState.Instance); // reimport all assets to load newly generated shaders AssetDatabase.Refresh(ImportAssetOptions.Default); // generate all materials foreach (string name in shaderNames) { for (int i = 0; i < blendModeCount; i++) { ShapesBlendMode blendMode = (ShapesBlendMode)i; string nameWithBlendMode = ShapesMaterials.GetMaterialName(name, blendMode.ToString()); Shader shader = Shader.Find($"Shapes/{nameWithBlendMode}"); if (shader == null) { Debug.LogError("missing shader " + $"Shapes/{nameWithBlendMode}"); continue; } if (ShaderBuilder.shaderKeywords.ContainsKey(name)) { // create all permutations MultiCompile[] multis = ShaderBuilder.shaderKeywords[name]; List <string> keywordPermutations = new List <string>(); foreach (IEnumerable <string> perm in GetPermutations(multis.Select(m => m.Enumerate()))) { IEnumerable <string> validKeywords = perm.Where(p => string.IsNullOrEmpty(p) == false); string kws = $" [{string.Join( "][", validKeywords )}]"; if (kws.Contains("[]")) // this means it has no permutations { kws = ""; } TryCreateMaterial(nameWithBlendMode + kws, validKeywords); } } else { TryCreateMaterial(nameWithBlendMode); } Material TryCreateMaterial(string fullMaterialName, IEnumerable <string> keywords = null) { string savePath = $"{ShapesIO.GeneratedMaterialsFolder}/{fullMaterialName}.mat"; Material mat = AssetDatabase.LoadAssetAtPath <Material>(savePath); void TrySetKeywordsAndDefaultProperties() { if (keywords != null) { foreach (string keyword in keywords) { mat.EnableKeyword(keyword); } } ShapesMaterials.ApplyDefaultGlobalProperties(mat); } if (mat != null) { EditorUtility.SetDirty(mat); mat.hideFlags = HideFlags.HideInInspector; TrySetKeywordsAndDefaultProperties(); } else { Debug.Log("creating material " + savePath); mat = new Material(shader) { enableInstancing = true, hideFlags = HideFlags.HideInInspector }; TrySetKeywordsAndDefaultProperties(); AssetDatabase.CreateAsset(mat, savePath); } return(mat); } } } AssetDatabase.Refresh(ImportAssetOptions.Default); }