public FormConsole(EmotePlayer emotePlayer, string info = "") { _emote = emotePlayer; InitializeComponent(); if (!string.IsNullOrWhiteSpace(info)) { this.Text = $"NekoConsole - {info}"; } _haveWind = chkWind.Checked; }
public void LoadCharacter(ICharacterListViewItem item) { lock (emote) { //lock (emote) { //players.ForEach(dr => emote.DeletePlayer(dr)); //players.Clear(); if (characterOffhand != null) { emote.DeletePlayer(characterOffhand); characterOffhandIntf = null; // allow falloff via GC, might look into disposable implementation if needed } characterOffhand = character; characterOffhandIntf = characterIntf; if (characterOffhand != null) { //characterOffhand.SetColor(0xffffff00, 20, 0.5f); characterOffhand.Hide(); // temporary } } EmotePlayer player = emote.CreatePlayer(item.Name, TransCryptCharacter(item.GetDataStream(), item.Key, emoteLibs.First().Key, item.ColorMode, emoteLibs.First().ColorMode)); player.SetScale(0.4f, 0, 0); player.SetCoord(0, 50, 0, 0); player.StartWind(0f, 1f, 0.8f, 0.5f, 0.8f); player.SetSmoothing(true); //player.SetColor(0xffffff00, 0, 0.0f); player.Show(); //player.SetColor(0xffffffff, 20, 0.5f); //players.Add(player); character = player; characterIntf = new CharacterControlInterface(character); //RenderBitmap(item.GetDataStream(), item.Key); } }
public MainWindow() { string[] args = Environment.GetCommandLineArgs(); if (args.Length <= 1) { _psbPath = "emote_test.pure.psb"; } else { _psbPath = args[1]; } if (!File.Exists(_psbPath)) { return; } _helper = new WindowInteropHelper(this); // create a D3DImage to host the scene and // monitor it for changes in front buffer availability _di = new D3DImage(); _di.IsFrontBufferAvailableChanged += OnIsFrontBufferAvailableChanged; MouseMove += MainWindow_MouseMove; MouseWheel += MainWindow_MouseWheel; MouseDoubleClick += MainWindow_MouseDoubleClick; KeyDown += OnKeyDown; // make a brush of the scene available as a resource on the window Resources["NekoHacksScene"] = new ImageBrush(_di); //double x = SystemParameters.WorkArea.Width; //得到屏幕工作区域宽度 //double y = SystemParameters.WorkArea.Height; //得到屏幕工作区域高度 //double x1 = SystemParameters.PrimaryScreenWidth; //得到屏幕整体宽度 //double y1 = SystemParameters.PrimaryScreenHeight; //得到屏幕整体高度 //WindowStartupLocation = WindowStartupLocation.Manual; //Left = x1 - 800; //Top = y1 - 600; // parse the XAML InitializeComponent(); //Topmost = true; //Width = 800; //Height = 600; _midX = Width / 2; _midY = Height / 2; CenterMark.Visibility = Visibility.Hidden; CharaCenterMark.Visibility = Visibility.Hidden; _emote = new Emote(_helper.EnsureHandle(), (int)Width, (int)Height, true); _emote.EmoteInit(); _player = _emote.CreatePlayer("Chara1", _psbPath); _player.SetScale(1, 0, 0); _player.SetCoord(0, 0); _player.SetVariable("fade_z", 256); _player.SetSmoothing(true); _player.Show(); // begin rendering the custom D3D scene into the D3DImage BeginRenderingScene(); }
public MainWindow() { _psbPath = Core.PsbPath; _extraPaths = Core.ExtraPaths; _helper = new WindowInteropHelper(this); // create a D3DImage to host the scene and // monitor it for changes in front buffer availability _di = new D3DImage(); _di.IsFrontBufferAvailableChanged += OnIsFrontBufferAvailableChanged; MouseMove += MainWindow_MouseMove; MouseWheel += MainWindow_MouseWheel; MouseDoubleClick += MainWindow_MouseDoubleClick; KeyDown += OnKeyDown; // make a brush of the scene available as a resource on the window Resources["NekoHacksScene"] = new ImageBrush(_di); //double x = SystemParameters.WorkArea.Width; //得到屏幕工作区域宽度 //double y = SystemParameters.WorkArea.Height; //得到屏幕工作区域高度 //double x1 = SystemParameters.PrimaryScreenWidth; //得到屏幕整体宽度 //double y1 = SystemParameters.PrimaryScreenHeight; //得到屏幕整体高度 //WindowStartupLocation = WindowStartupLocation.Manual; //Left = x1 - 800; //Top = y1 - 600; // parse the XAML InitializeComponent(); Width = Core.Width; Height = Core.Height; //Topmost = true; //Width = 800; //Height = 600; _midX = Width / 2; _midY = Height / 2; CenterMark.Visibility = Visibility.Hidden; CharaCenterMark.Visibility = Visibility.Hidden; _emote = new Emote(_helper.EnsureHandle(), (int)Width, (int)Height, true); _emote.EmoteInit(); if (_extraPaths != null) { _player = _emote.CreatePlayer("CombinedChara1", new[] { _psbPath }.Concat(_extraPaths).ToArray()); } else { _player = _emote.CreatePlayer("Chara1", _psbPath); } _player.SetScale(1, 0, 0); _player.SetCoord(0, 0); _player.SetVariable("fade_z", 256); _player.SetSmoothing(true); _player.Show(); if (Core.NeedRemoveTempFile) { File.Delete(_psbPath); Core.NeedRemoveTempFile = false; } // begin rendering the custom D3D scene into the D3DImage BeginRenderingScene(); }
static unsafe void Main(string[] args) { Application.EnableVisualStyles(); _screenRect = Screen.PrimaryScreen.Bounds; _form = new RenderForm("AZUSA E-mote Sample - NekoSpirit"); _form.AutoScaleMode = AutoScaleMode.None; //_form.FormBorderStyle = FormBorderStyle.None; _form.ClientSize = new Size(Width, Height); _form.Resize += FormOnResize; FormOnResize(_form, null); //form.TopMost = true; _form.StartPosition = FormStartPosition.Manual; _form.Location = new Point(_screenRect.Width - _form.Width, _screenRect.Height - _form.Height); //form.AllowTransparency = true; _e = new Emote(_form.Handle, Width, Height, false); _e.EmoteInit(); _e.Device.TextureFilter = GrayTextureFilter; if (File.Exists(args[0])) { _player = _e.CreatePlayer("Chara1", args[0]); } else { _player = _e.CreatePlayer("Chara1", "emote_test.pure.psb"); } _e.Device.UseTextureFilter = false; //turn on texture filter! //e.Device.SetMaskRegionClipping(true); //Set this to true will increase CPU usage but decrease GPU usage. //_player2 = _e.CreatePlayer("Chara2", "chocola-pure.psb"); //I don't know how to use this method. I guess this method may combine two models (only if they are complementary). //virtual void CreatePlayer (emote_uint32_t emoteObjectNum, const emote_uint8_t **emoteObjectImage, const emote_uint32_t *emoteObjectSize, class IEmotePlayer **player)=0 //_player2 = e.CreatePlayer("Chocola", new[] {"dx_e-mote3.0ショコラ制服b_鈴あり.psb", "dx_e-mote3.0バニラ私服b_鈴あり.psb"}); _player.Show(); //_player2.Show(); var faceTable = new Dictionary <string, float> { { "face_eye_UD", -30f }, { "face_eye_LR", 0.0f }, { "face_eye_open", 5 }, { "face_eyebrow", 20f }, { "face_mouth", 20 }, { "face_talk", 0.5f }, { "face_tears", 0.0f }, { "face_cheek", 0.0f } }; _device = new Device(new IntPtr(_e.D3Device)); _player.SetScale(0.4f, 0, 0); _player.SetCoord(300, 50, 0, 0); _player.StartWind(0f, 1f, 0.8f, 0.5f, 0.8f); _player.SetSmoothing(true); //for (uint i = 0; i < _player.CountVariables(); i++) //{ // for (uint j = 0; j < _player.CountVariableFrameAt(i); j++) // { // Console.WriteLine($"{_player.GetVariableFrameLabelAt(i, j)}:{_player.GetVariableFrameValueAt(i,j)}"); // } //} //_player2.SetScale(0.4f, 0, 0); //_player2.SetCoord(-100, 50, 0, 0); //_player2.SetSmoothing(true); //_player2.SetVariables(faceTable, 2000f, 1f); //-Why are you so angry? -Why am I monochrome? //_player.PlayTimeline("変な動き", TimelinePlayFlags.TIMELINE_PLAY_PARALLEL); //_player2.PlayTimeline("差分用_waiting_loop", TimelinePlayFlags.TIMELINE_PLAY_PARALLEL); //ctrlform.TopMost = true; Thread th = new Thread(() => { //var ctrlform2 = new FormConsole(_player2, "Chara2"); //ctrlform2.Closed += // (sender, eventArgs) => // { // _e.DeletePlayer(_player2); //Try to close this form, the memory will be released // }; //ctrlform2.Show(); var ctrlform = new FormConsole(_player, "Chara1"); //ctrlform.Show(); Application.Run(ctrlform); }); th.Start(); //Control _form.MouseClick += form_MouseClick; _form.MouseDown += form_MouseDown; _form.MouseMove += form_MouseMove; _form.MouseUp += form_MouseUp; _form.MouseWheel += (sender, eventArgs) => _player.OffsetScale(1 + ConvertDelta(eventArgs.Delta)); _form.Load += (sender, eventArgs) => { _form.Activate(); }; RenderLoop.Run(_form, Render); }
public MainWindow() { string[] args = Environment.GetCommandLineArgs(); if (args.Length <= 1) { _psbPath = "FreeMote.psb"; } else if (args.Length == 2) { _psbPath = args.Last(); _extraPaths = null; } else { _psbPath = args[1]; _extraPaths = args.Skip(2).ToArray(); } bool quickLoad = args.Contains("-d"); bool removeTempFile = false; if (!File.Exists(_psbPath)) { return; } if (!quickLoad) { try { FreeMount.Init(); using (var fs = File.OpenRead(_psbPath)) { var ctx = FreeMount.CreateContext(); string currentType = null; var ms = ctx.OpenFromShell(fs, ref currentType); var psb = ms != null ? new PSB(ms) : new PSB(fs); if (psb.Platform == PsbSpec.krkr) { psb.SwitchSpec(PsbSpec.win, PsbSpec.win.DefaultPixelFormat()); } psb.Merge(); _psbPath = Path.GetTempFileName(); File.WriteAllBytes(_psbPath, psb.Build()); removeTempFile = true; ms?.Dispose(); } GC.Collect(); //Can save memory from 700MB to 400MB } catch (Exception e) { //ignore } } _helper = new WindowInteropHelper(this); // create a D3DImage to host the scene and // monitor it for changes in front buffer availability _di = new D3DImage(); _di.IsFrontBufferAvailableChanged += OnIsFrontBufferAvailableChanged; MouseMove += MainWindow_MouseMove; MouseWheel += MainWindow_MouseWheel; MouseDoubleClick += MainWindow_MouseDoubleClick; KeyDown += OnKeyDown; // make a brush of the scene available as a resource on the window Resources["NekoHacksScene"] = new ImageBrush(_di); //double x = SystemParameters.WorkArea.Width; //得到屏幕工作区域宽度 //double y = SystemParameters.WorkArea.Height; //得到屏幕工作区域高度 //double x1 = SystemParameters.PrimaryScreenWidth; //得到屏幕整体宽度 //double y1 = SystemParameters.PrimaryScreenHeight; //得到屏幕整体高度 //WindowStartupLocation = WindowStartupLocation.Manual; //Left = x1 - 800; //Top = y1 - 600; // parse the XAML InitializeComponent(); //Topmost = true; //Width = 800; //Height = 600; _midX = Width / 2; _midY = Height / 2; CenterMark.Visibility = Visibility.Hidden; CharaCenterMark.Visibility = Visibility.Hidden; _emote = new Emote(_helper.EnsureHandle(), (int)Width, (int)Height, true); _emote.EmoteInit(); if (_extraPaths != null) { _player = _emote.CreatePlayer("CombinedChara1", new[] { _psbPath }.Concat(_extraPaths).ToArray()); } else { _player = _emote.CreatePlayer("Chara1", _psbPath); } _player.SetScale(1, 0, 0); _player.SetCoord(0, 0); _player.SetVariable("fade_z", 256); _player.SetSmoothing(true); _player.Show(); if (removeTempFile) { File.Delete(_psbPath); } // begin rendering the custom D3D scene into the D3DImage BeginRenderingScene(); }
IEnumerator Start() { yield return(Application.RequestUserAuthorization(UserAuthorization.Microphone)); var path = Application.dataPath; switch (Application.platform) { case RuntimePlatform.WindowsEditor: path += "/StreamingAssets/"; break; case RuntimePlatform.WindowsPlayer: path += "/StreamingAssets/"; break; case RuntimePlatform.IPhonePlayer: path += "/Raw/"; break; } path += "dictation-kit-v4.4/run-win-gmm.jconf"; // path += "dictation-kit-v4.4/run-win-dnn.jconf"; Julius.ResultReceived += OnResultReceived; Julius.Begin(path); this.recogText.text = ""; this.messageText.text = ""; this.wStatusText.text = EMOTION_LABELS["neutral"]; this.wStatusText.color = EMOTION_COLORS["neutral"]; this.wValueText.text = "0%"; this.fStatusText.text = EMOTION_LABELS["neutral"]; this.fStatusText.color = EMOTION_COLORS["neutral"]; this.fValueText.text = "0%"; this.vStatusText.text = EMOTION_LABELS["neutral"]; this.vStatusText.color = EMOTION_COLORS["neutral"]; this.vValueText.text = "0%"; if (targetPlayer == null) { targetPlayer = this.GetComponent(typeof(EmotePlayer)) as EmotePlayer; } if (targetAudio == null) { targetAudio = this.GetComponent(typeof(AudioSource)) as AudioSource; } string[] angry = { "まったくですね。\n腹が立ちますよね。プンプン!", "angry_00", "sample_怒00" }; string[] disgust = { "うわぁ~!\n嫌ですね~吐き気がします!", "disgust_00", "sample_哀00" }; string[] fear = { "キャー!!恐ろしい!\n怖すぎます!!", "fear_00", "sample_驚00" }; string[] happy = { "良かったですね!\nその調子でいきましょう!", "happy_00", "sample_喜00" }; string[] neutral = { "他に何か言いたいことはありませんか?", "neutral_00", "背伸び" }; string[] sad = { "悲しいですね…\n私も泣きたくなります…", "sad_00", "sample_哀01" }; string[] surprise = { "ワァー!マジですか!\n本当にびっくりですね!", "surprise_00", "sample_驚01" }; this.emotionSentences = new Dictionary <string, string[]>() { { "angry", angry }, { "disgust", disgust }, { "fear", fear }, { "happy", happy }, { "neutral", neutral }, { "sad", sad }, { "surprise", surprise } }; this.StartWordRecogProcess(); this._mainContext = SynchronizationContext.Current; }