/// <summary>
 /// Creates a player unit from a unit template.
 /// </summary>
 /// <param name="unitType"></param>
 /// <param name="attributes"></param>
 /// <param name="gridWidth"></param>
 /// <param name="gridHeight"></param>
 public CorePlayerUnit(PlayerUnitType unitType, UnitAttributes attributes, CorePlayer player, int gridWidth, int gridHeight)
     : base(EntityType.PlayerUnit, gridWidth, gridHeight)
 {
     UnitType    = unitType;
     Player      = player;
     _attributes = new UnitAttributes(attributes);
 }
Example #2
0
        public async void PlayAsync(int loopCount = -1, int fadeOutTime = 2000)
        {
            await Task.Run(async() =>
            {
                CorePlayer.Play(loopCount, fadeOutTime);

                IsPlaying = true;
                while (true)
                {
                    CorePlayer.GetBuffer(_buffer);

                    if (!CorePlayer.IsPlaying || _cts.IsCancellationRequested)
                    {
                        break;
                    }

                    var b = ToByte(_buffer);


                    _bwp.AddSamples(b, 0, b.Length);

                    while (_bwp.BufferedBytes > _buffer.Length * 8)
                    {
                        await Task.Delay(1);
                    }
                }
                IsPlaying = false;
            });
        }
 void Initialize(TitleDatabase database, MainActivity activity)
 {
     this.activity           = activity;
     view                    = new PlayerView(this, database, activity);
     task                    = new CorePlayer(this);
     headset_status_receiver = new HeadphoneStatusReceiver(this);
 }
Example #4
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     performGlobalInitialization();
     Program.playerWindow = new PlayerWindow();
     Program.player       = new CorePlayer();
     Application.Run(Program.playerWindow);
 }
Example #5
0
    public Script()
    {
        string     content     = "ctrl+w script-message my-message-1 my-argument-1";
        string     sectionName = Assembly.GetExecutingAssembly().GetName().Name;
        CorePlayer core        = Global.Core;

        core.CommandV("define-section", sectionName, content, "force");
        core.CommandV("enable-section", sectionName);
        core.ClientMessage += ClientMessage;
    }
Example #6
0
 // Start is called before the first frame update
 void Start()
 {
     target      = PlayerManager.Instance.player.transform;
     core        = target.GetComponent <CorePlayer>();
     agent       = GetComponent <NavMeshAgent>();
     anim        = GetComponentInChildren <Animator>();
     agent.speed = speed;
     hp          = hpMax;
     healthBar   = GetComponentInChildren <enemyHealthBar>();
 }
Example #7
0
 public async Task StopAsync()
 {
     await Task.Run(async() =>
     {
         CorePlayer.Stop();
         while (IsPlaying)
         {
             await Task.Delay(1);
         }
     });
 }
Example #8
0
    public void MapFor4Players()
    {
        List <GameObject> positionCore = GetComponent <Create_map>().PositionCore;

        botCore = new Core[3];
        for (int i = 0; i < 3; i++)
        {
            botCore[i] = new Core(new Color(0, 1, 0), positionCore[i]);
            positionCore[i].transform.GetComponent <Cell>().SomethingObj = botCore[i];
        }


        playerCore = new CorePlayer(new Color(0, 0, 1), positionCore[3], panelParent, panelTemplate);
        positionCore[3].transform.GetComponent <Cell>().SomethingObj = playerCore;
    }
Example #9
0
        /// <summary>
        /// MIDI ファイルのパスを指定して、再生を開始します。
        /// </summary>
        /// <param name="filePath">ファイルパス。</param>
        /// <param name="loopCount"></param>
        /// <param name="fadeOutTime"></param>
        public void Play(string filePath, int loopCount = -1, int fadeOutTime = 2000)
        {
            // 正しく生成されていればこれらはnullでないはずなので、例外が投げられたらバグが起きているはず
            if (CorePlayer == null ||
                _nativeplayer == null ||
                _cts == null ||
                _buffer == null
                )
            {
                throw new InvalidOperationException("初期化が完了していません。");
            }

            CorePlayer.Load(SmfParser.Parse(F.OpenRead(P.Combine(AppDomain.CurrentDomain.BaseDirectory, filePath))));

            PlayAsync(loopCount, fadeOutTime);
        }
Example #10
0
        public async Task SaveAsync(string path, int loopCount = 2, MidiFile mf = null)
        {
            CorePlayer.Stop();
            if (mf != null)
            {
                CorePlayer.Load(mf);
            }
            CorePlayer.Play(loopCount);

            using (var wfw = new WaveFileWriter(path, new WaveFormat()))
            {
                while (CorePlayer.IsPlaying)
                {
                    byte[] b = ToByte(CorePlayer.GetBuffer(_buffer));
                    await wfw.WriteAsync(b, 0, b.Length);
                }
            }
        }
 public void Play()
 {
     if (task.Status == PlayerStatus.Paused)
     {
         task.Resume();
     }
     else
     {
         Stop();
         SpinWait.SpinUntil(() => task.Status == PlayerStatus.Stopped);
         if (task != null)
         {
             task.Dispose();
         }
         task = new CorePlayer(this);
         InitializeVorbisBuffer();
         start_time = DateTime.Now;
         task.Start();
     }
     view.SetPlayState();
     activity.RegisterReceiver(headset_status_receiver, new IntentFilter(AudioManager.ActionAudioBecomingNoisy));
 }
 // Start is called before the first frame update
 void Start()
 {
     anim = GetComponentInChildren <Animator>();
     core = GetComponent <CorePlayer>();
 }
 public Script()
 {
     Core = Global.Core;
     Core.observe_property_bool("fullscreen", FullscreenChange);
 }
 public Script()
 {
     Core = Global.Core;
     Core.ObservePropertyBool("fullscreen", FullscreenChange);
 }
Example #15
0
 public Script()
 {
     Core             = Global.Core;
     MainForm         = MainForm.Instance;
     MainForm.Resize += Form_Resize;
 }
Example #16
0
 private void Start()
 {
     core    = PlayerManager.Instance.player.GetComponent <CorePlayer>();
     upgShop = PlayerManager.Instance.player.GetComponent <upgradeShop>();
 }
 public Script()
 {
     Core     = Global.Core;
     MainForm = MainForm.Instance;
     MainForm.ContextMenu.Opening += ContextMenu_Opening;
 }
 private void Start()
 {
     core = GetComponent <CorePlayer>();
 }
Example #19
0
 void Start()
 {
     core = PlayerManager.Instance.player.GetComponent <CorePlayer>();
 }
 void Initialize(TitleDatabase database, MainActivity activity)
 {
     this.activity = activity;
     view = new PlayerView (this, database, activity);
     task = new CorePlayer (this);
     headset_status_receiver = new HeadphoneStatusReceiver (this);
 }
 public void Play()
 {
     if (task.Status == PlayerStatus.Paused)
         task.Resume ();
     else {
         Stop ();
         SpinWait.SpinUntil(() => task.Status == PlayerStatus.Stopped);
         if (task != null)
             task.Dispose ();
         task = new CorePlayer (this);
         InitializeVorbisBuffer ();
         start_time = DateTime.Now;
         task.Start ();
     }
     view.SetPlayState ();
     activity.RegisterReceiver (headset_status_receiver, new IntentFilter(AudioManager.ActionAudioBecomingNoisy));
 }
Example #22
0
 public Script() // plugin initialization
 {
     Core = Global.Core;
     Core.ClientMessage += ClientMessage; //handles keys defined in input.conf
     Core.Shutdown      += Shutdown;      // handles MPV_EVENT_SHUTDOWN
 }
Example #23
0
 public Script()
 {
     Core = Global.Core;
     Core.ClientMessage += ClientMessage;
 }
 public void clearCore()
 {
     core = null;
 }
 /// <summary>
 /// Creates a player unit from a copy of another unit.
 /// Use this in the client code to initialise unit fields properly.
 /// </summary>
 /// <param name="copy"></param>
 public CorePlayerUnit(CorePlayerUnit copy) : base(copy)
 {
     UnitType    = copy.UnitType;
     Player      = copy.Player;
     _attributes = new UnitAttributes(copy._attributes);
 }
 static void Main()
 {
     CorePlayer player = new CorePlayer();
 }