void CreateCSharpCodeModel(string savePath, ModelInformation modelInfomation, bool createInteraface) { string newSavePath = savePath + "/Model"; CreateFolder(newSavePath); string filePath = newSavePath + "/" + modelInfomation.ModelName + ".cs"; //ファイルの存在チェック if (File.Exists(filePath)) { //存在する場合は抹消 File.Delete(filePath); } Encoding enc = System.Text.Encoding.UTF8; //Encoding enc = Encoding.GetEncoding("Shift_JIS"); using (StreamWriter writer = new StreamWriter(filePath, true, enc)) { writer.WriteLine("using UnityEngine;"); writer.WriteLine("using System.Collections.Generic;" + Environment.NewLine); writer.WriteLine("[System.Serializable]"); writer.WriteLine("public class " + modelInfomation.ModelName + (createInteraface?":I" + modelInfomation.ModelName : "")); writer.WriteLine("{" + Environment.NewLine); foreach (var p in modelInfomation.Properties) { writer.WriteLine(" " + "[SerializeField]"); writer.WriteLine(" " + p.Type + " " + p.PrivateName + ";"); writer.WriteLine(" " + "public " + p.Type + " " + p.PublicName + " => " + p.PrivateName + ";"); writer.WriteLine(Environment.NewLine); } writer.WriteLine("}"); } }
void CreateCSharpCodeInterface(string savePath, ModelInformation modelInfomation) { string newSavePath = savePath + "/Interface"; CreateFolder(newSavePath); string filePath = newSavePath + "/I" + modelInfomation.ModelName + ".cs"; //ファイルの存在チェック if (File.Exists(filePath)) { //存在する場合は抹消 File.Delete(filePath); } Encoding enc = System.Text.Encoding.UTF8; //Encoding enc = Encoding.GetEncoding("Shift_JIS"); using (StreamWriter writer = new StreamWriter(filePath, true, enc)) { writer.WriteLine("using UnityEngine;"); writer.WriteLine("using System.Collections.Generic;" + Environment.NewLine); writer.WriteLine("public interface I" + modelInfomation.ModelName); writer.WriteLine("{" + Environment.NewLine); foreach (var p in modelInfomation.Properties) { writer.WriteLine(" " + p.Type + " " + p.PublicName + " { get; }"); writer.WriteLine(Environment.NewLine); } writer.WriteLine("}"); } }
void CreateDatastore(string savePath, ModelInformation modelInfomation) { string newSavePath = savePath + "/Datastore"; CreateFolder(newSavePath); string filePath = newSavePath + "/" + modelInfomation.ModelName + "DataStore.cs"; //ファイルの存在チェック if (File.Exists(filePath)) { //存在する場合は抹消 File.Delete(filePath); } Encoding enc = System.Text.Encoding.UTF8; //Encoding enc = Encoding.GetEncoding("Shift_JIS"); using (StreamWriter writer = new StreamWriter(filePath, true, enc)) { writer.WriteLine("using UnityEngine;"); writer.WriteLine("using Qitz.DataStoreExtension;"); writer.WriteLine("using System.Collections.Generic;" + Environment.NewLine); writer.WriteLine($"public class {modelInfomation.ModelName}DataStore : BaseDataStore<{modelInfomation.ModelName}>"); writer.WriteLine("{"); writer.WriteLine(" [ContextMenu(\"サーバーからデータを読み込む\")]"); writer.WriteLine(" protected override void LoadDataFromServer()"); writer.WriteLine(" {"); writer.WriteLine(" base.LoadDataFromServer();"); writer.WriteLine(" }"); writer.WriteLine("}"); } }
string CreateDatastoreScriptMetaAndGUID(string savePath, ModelInformation modelInfomation) { string guid = System.Guid.NewGuid().ToString().Replace("-", ""); string newSavePath = savePath + "/Datastore"; CreateFolder(newSavePath); string filePath = newSavePath + "/" + modelInfomation.ModelName + "DataStore.cs.meta"; //ファイルの存在チェック if (File.Exists(filePath)) { //存在する場合は抹消 File.Delete(filePath); } Encoding enc = System.Text.Encoding.UTF8; //Encoding enc = Encoding.GetEncoding("Shift_JIS"); using (StreamWriter writer = new StreamWriter(filePath, true, enc)) { writer.WriteLine("fileFormatVersion: 2"); writer.WriteLine($"guid: {guid}"); writer.WriteLine("MonoImporter:"); writer.WriteLine(" externalObjects: {}"); writer.WriteLine(" serializedVersion: 2"); writer.WriteLine(" defaultReferences: []"); writer.WriteLine(" executionOrder: 0"); writer.WriteLine(" icon: {instanceID: 0}"); writer.WriteLine(" userData: "); writer.WriteLine(" assetBundleName: "); writer.WriteLine(" assetBundleVariant: "); } return(guid); }
public void Visit(BeginMappedProperty instruction, Func <ClarifyGenericMapEntry, ClarifyDataRow, bool> condition) { executeInstruction(() => { var parentClarifyGenericMap = _genericStack.Peek(); var key = instruction.Key.Resolve(_services).ToString(); var childModel = new ModelInformation { ModelName = key, ParentProperty = key, AllowEmpty = instruction.AllowEmpty }; var clarifyGenericMap = new ClarifyGenericMapEntry { ClarifyGeneric = parentClarifyGenericMap.ClarifyGeneric, Model = childModel, Condition = condition }; parentClarifyGenericMap.AddChildGenericMap(clarifyGenericMap); _genericStack.Push(clarifyGenericMap); _modelStack.Push(childModel); }); }
void CreateDatastoreAsset(string savePath, ModelInformation modelInfomation, string guid) { string newSavePath = savePath + "/MasterData"; CreateFolder(newSavePath); string filePath = newSavePath + "/" + modelInfomation.ModelName + "DataStore.asset"; //ファイルの存在チェック if (File.Exists(filePath)) { //存在する場合は抹消 File.Delete(filePath); } Encoding enc = System.Text.Encoding.UTF8; //Encoding enc = Encoding.GetEncoding("Shift_JIS"); using (StreamWriter writer = new StreamWriter(filePath, true, enc)) { writer.WriteLine("%YAML 1.1"); writer.WriteLine("%TAG !u! tag:unity3d.com,2011:"); writer.WriteLine("--- !u!114 &11400000"); writer.WriteLine("MonoBehaviour:"); writer.WriteLine(" m_ObjectHideFlags: 0"); writer.WriteLine(" m_CorrespondingSourceObject: {fileID: 0}"); writer.WriteLine(" m_PrefabInstance: {fileID: 0}"); writer.WriteLine(" m_PrefabAsset: {fileID: 0}"); writer.WriteLine(" m_GameObject: {fileID: 0}"); writer.WriteLine(" m_Enabled: 1"); writer.WriteLine(" m_EditorHideFlags: 0"); writer.WriteLine(" m_Script: {fileID: 11500000, guid: " + guid + ", type: 3}"); writer.WriteLine($" m_Name: {modelInfomation.ModelName}DataStore"); writer.WriteLine(" m_EditorClassIdentifier: "); } }
public async Task <IActionResult> Edit(int id, [Bind("UserId,Age,Gender,Height,ModelType,Bust,Waist,Hips,InstagramUrl,FacebookUrl,Nationality,Ethnicity,Country,City,IsDeleted,DeletedOn,Id,CreatedOn,ModifiedOn")] ModelInformation modelInformation) { if (id != modelInformation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(modelInformation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ModelInformationExists(modelInformation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", modelInformation.UserId); return(View(modelInformation)); }
public async Task <string> InsertModelInformation(string id) { var checkUser = await this.modelInformationRepository .All() .Where(x => x.UserId == id).FirstOrDefaultAsync(); if (checkUser != null) { return(InfoUpdate); } var modelInformation = new ModelInformation { UserId = id, Country = "None", City = "None", Age = 16, Bust = 0, Hips = 0, Height = 0, Ethnicity = Enum.Parse <Ethnicity>("Other"), Gender = Enum.Parse <Gender>("Other"), Nationality = "Bulgarian", }; await this.modelInformationRepository.AddAsync(modelInformation); await this.modelInformationRepository.SaveChangesAsync(); return(InfoCreated); }
private static void ProcessModelInformation(ModelInformation modelInformation) { if (modelInformation.DisplayName == null) modelInformation.DisplayName = SplitWords(modelInformation.Name); if (modelInformation.ShortName == null) modelInformation.ShortName = modelInformation.DisplayName; }
public async Task <IActionResult> Create([Bind("UserId,Age,Gender,Height,ModelType,Bust,Waist,Hips,InstagramUrl,FacebookUrl,Nationality,Ethnicity,Country,City,IsDeleted,DeletedOn,Id,CreatedOn,ModifiedOn")] ModelInformation modelInformation) { if (ModelState.IsValid) { _context.Add(modelInformation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", modelInformation.UserId); return(View(modelInformation)); }
public void Visit(BeginMappedProperty instruction) { var parentClarifyGenericMap = _genericStack.Peek(); var key = instruction.Key.Resolve(_services).ToString(); var childModel = new ModelInformation { ModelName = key, ParentProperty = key, AllowEmpty = instruction.AllowEmpty }; var clarifyGenericMap = new ClarifyGenericMapEntry { ClarifyGeneric = parentClarifyGenericMap.ClarifyGeneric, Model = childModel }; parentClarifyGenericMap.AddChildGenericMap(clarifyGenericMap); _genericStack.Push(clarifyGenericMap); _modelStack.Push(childModel); }
public AdmInformationController() { _modelInformation = new ModelInformation(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); Keyboard.KeyDown += (object sender, KeyboardKeyEventArgs key) => { if (key.Key == Key.F12) { if (VSync == VSyncMode.Off) { VSync = VSyncMode.Adaptive; } else { VSync = VSyncMode.Off; } } if (key.Key == Key.F11) { if (WindowState != WindowState.Fullscreen) { WindowState = WindowState.Fullscreen; } else { WindowState = WindowState.Normal; } } if (key.Key == Key.F10) { Wireframe = !Wireframe; } if (key.Key == Key.F9) { Bloom = !Bloom; } if (key.Key == Key.F8) { Fxaa = !Fxaa; } if (key.Key == Key.F7) { LightScattering = !LightScattering; } if (key.Key == Key.F1) { ModelBatch.RowOrder = !ModelBatch.RowOrder; } if (key.Key == Key.F6) { sun.Color = (sun.Color.Length == 0 ? new Vector3(1, 1, 1) : new Vector3(0, 0, 0)); } if (key.Key == Key.Tab) { Root.Remove(monkeynode); Root.Add(monkeynode = new GameObject()); } if (key.Key == Key.Space) { monkeynode.Add(new ModelRenderer(monkey, new Matrix4(1, 0, 0, Camera.Position.X, 0, 1, 0, Camera.Position.Y, 0, 0, 1, Camera.Position.Z, 0, 0, 0, 1) * Matrix4.CreateFromQuaternion(Camera.Rotation) * Matrix4.CreateRotationY((float)Math.PI))); } }; Mouse.ButtonDown += (object sender, MouseButtonEventArgs key) => { if (CursorVisible == false) { if (key.Button == MouseButton.Left) { Random rew = new Random(); monkeynode.Add(new PointLight(Camera.Position).SetColor(new Vector3((float)rew.NextDouble(), (float)rew.NextDouble(), (float)rew.NextDouble()) * 4)); } if (key.Button == MouseButton.Middle) { Random rew = new Random(); monkeynode.Add(new DirectionalLight(Camera.Forward).SetColor(new Vector3((float)rew.NextDouble(), (float)rew.NextDouble(), (float)rew.NextDouble()) * 0.5f)); } if (key.Button == MouseButton.Right) { Random rew = new Random(); monkeynode.Add(new SpotLight(Camera.Position, Camera.Forward).SetCLQ(1, 0.09f, 0.0001f).SetColor(new Vector3((float)rew.NextDouble(), (float)rew.NextDouble(), (float)rew.NextDouble()) * 4)); } } }; AmbientLight = new Vector3(0.1f, 0.1f, 0.1f); sun = new DirectionalLight(new Vector3(0, -1, 0)); time = 30; Root.Add(sun); Root.Add(new LightScatteringComponent(new Vector3(1.0f, 0.8f, 0.3f))); monkey = ModelBatch.LoadModel(Faces.FromFile(@".\Data\Model\Monkey.lpm"));//new Model(faces) Root.Add((specialmonkey = new ModelRenderer(monkey, Matrix4.Identity))); Root.Add(new ModelRenderer(ModelBatch.LoadModel(Faces.FromFile(@".\Data\Model\World.lpm")))); Root.Add(monkeynode = new GameObject()); }