Пример #1
0
        public MainWindow(PlayInfo info)
        {
            InitializeComponent();

            Mouse.OverrideCursor = Cursors.None;
            Cursor = Cursors.None;
            Topmost = true;
            WindowStyle = WindowStyle.None;
            WindowState = WindowState.Maximized;
            Background = Brushes.Transparent;
            AllowsTransparency = true;
            ShowInTaskbar = false;
            Opacity = 1.0;

            _info = info;

            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
            this.LocationChanged += (s, e) =>
            {
                _isActive = false;
            };
            this.SizeChanged += (s, e) =>
            {
                _isActive = false;
            };
        }
Пример #2
0
        public MainPanel(PlayInfo info, bool silent)
        {
            InitializeComponent();

            _silent = silent;
            _onePlay = info;
            this.DataContext = this;

            this.Loaded += (s, e) =>
            {
                Mouse.OverrideCursor = Cursors.None;
                init();
            };
            this.SizeChanged += (s, e) => { AdjustMovieSize(); };
        }
Пример #3
0
    static void CalcKeyFrameIndex(PlayInfo playInfo)
    {
        for (int i = 0; i < playInfo.animData.sampleDatas.Count; ++i)
        {
            SampleData sample = playInfo.animData.sampleDatas[i];
            if (sample.time <= playInfo.realTime)
            {
                playInfo.keyFrameIndex1 = i;
                playInfo.keyFrameIndex2 = i + 1;
            }
            else
            {
                break;
            }
        }

        playInfo.keyFrameIndex1 = System.Math.Max(0, playInfo.keyFrameIndex1);
        playInfo.keyFrameIndex2 = System.Math.Min(playInfo.animData.sampleDatas.Count - 1, playInfo.keyFrameIndex2);
    }
Пример #4
0
    void UpdateShow()
    {
        //setId方法暂不能实现,直接将图片从Unity中进行修改
        PlayInfo info = PlayInfo._instance;

        //helmEquip.SetId(info.HelmID);
        //closeEquip.SetId(info.ClothID);
        //shoesEquip.SetId(info.ShoesID);
        //weaponEquip.SetId(info.ShoesID);
        //necklaceEquip.SetId(info.NecklaceID);
        //braceleEquip.SetId(info.BraceletID);
        //ringEquip.SetId(info.RingID);
        //wingsEquip.SetId(info.WingsID);

        hp.text         = info.Hp.ToString();
        damage.text     = info.Damage.ToString();
        expSlider.value = (float)info.Exp / GameController.GetNeedExpByLevel(info.Level + 1);
        exp.text        = info.Exp + "/" + GameController.GetNeedExpByLevel(info.Level + 1);
    }
Пример #5
0
    /**
     * @brief Play an audio clip on the attached audio source.
     * @param a_audioString is the string containing the audio clip name with volume and pitch variance.
     * @param a_altAudioSource is the alternative audio source to play the sound from.
     * @return void.
     * */
    public void PlayClip(string a_audioString, AudioSource a_altAudioSource = null)
    {
        PlayInfo playInfo = InterpretPlayString(a_audioString);

        AudioSource source = a_altAudioSource;

        // No alternate audio source provided, use set target
        if (!source)
        {
            source = _targetSource;
        }

        // Set audio source clip info
        source.pitch  = playInfo.o_pitch;
        source.clip   = playInfo.o_clip;
        source.volume = playInfo.volume;

        source.Play();
    }
Пример #6
0
    private NarrationData GetSprintNarration(PlayInfo _lastPlay)
    {
        NarrationData narData = new NarrationData();

        narData.PlayInfo = _lastPlay;

        if (_lastPlay.IsActionSuccessful)
        {
            narData.Text = "nar_Sprint_";
            SetNarrationPlayers(narData, _lastPlay.Attacker, _lastPlay.Defender);
        }
        else
        {
            SetNarrationPlayers(narData, _lastPlay.Attacker, _lastPlay.Defender);
            narData.Text = "nar_WrongSprint_1";
        }

        return(narData);
    }
Пример #7
0
    private NarrationData GetPassNarration(PlayInfo _lastPlay, PlayInfo _currentPlay)
    {
        NarrationData narData = new NarrationData();

        narData.PlayInfo = _lastPlay;

        if (_lastPlay.IsActionSuccessful)
        {
            flowPasses++;
            if (flowPasses == 3)
            {
                narData.Text       = "nar_FlowPasses_";
                narData.Variations = 1;
            }
            else
            {
                switch (_lastPlay.OffenseExcitment)
                {
                case -1: narData.Text = "nar_WorstPass_"; break;

                case 0: narData.Text = "nar_Pass_"; break;

                case 1: narData.Text = "nar_BestPass_"; break;
                }
                narData.Variations = 3;
            }
            SetNarrationPlayers(narData, _lastPlay.Attacker, _currentPlay.Attacker);
        }
        else
        {
            if (_lastPlay.IsActionDefended)
            {
                SetNarrationPlayers(narData, _lastPlay.Defender, _lastPlay.Attacker);
                narData.Text = "nar_BlockPass_";
            }
            else
            {
                SetNarrationPlayers(narData, _lastPlay.Attacker, _lastPlay.Defender);
                narData.Text = "nar_WrongPass_";
            }
        }
        return(narData);
    }
Пример #8
0
    public PlayInfo GetOffensiveActionRolls(PlayInfo _currentPlay, PlayInfo _lastPlay)
    {
        switch (_currentPlay.OffensiveAction)
        {
        case PlayerAction.Pass:
            _currentPlay.AttackFatigueRate = fatigueLow;
            _currentPlay = GetPassRolls(_currentPlay, _lastPlay);
            break;

        case PlayerAction.LongPass:
            _currentPlay.AttackFatigueRate = fatigueMedium;
            _currentPlay = GetLongPassRolls(_currentPlay);
            break;

        case PlayerAction.Dribble:
            _currentPlay.AttackFatigueRate = fatigueHigh;
            _currentPlay = GetDribbleRolls(_currentPlay);
            break;

        case PlayerAction.Sprint:
            _currentPlay.AttackFatigueRate = fatigueMedium;
            _currentPlay = GetSprintRolls(_currentPlay);
            break;

        case PlayerAction.Cross:
            _currentPlay.AttackFatigueRate = fatigueLow;
            _currentPlay = GetCrossRolls(_currentPlay);
            break;

        case PlayerAction.Shot:
            _currentPlay.AttackFatigueRate = fatigueLow;
            _currentPlay = GetShotRolls(_currentPlay);
            break;

        case PlayerAction.Header:
            _currentPlay.AttackFatigueRate = fatigueMedium;
            _currentPlay = GetHeaderRolls(_currentPlay);
            break;
        }

        return(_currentPlay);
    }
Пример #9
0
    IEnumerator DelayPlayClip(string a_audioString, float a_delayS, bool a_bPreload = false)
    {
        // Load clip before the delay to avoid stuttering
        if (a_bPreload)
        {
            PlayInfo playInfo = InterpretPlayString(a_audioString);
            _targetSource.clip   = playInfo.o_clip;
            _targetSource.pitch  = playInfo.o_pitch;
            _targetSource.volume = playInfo.volume;

            _targetSource.PlayDelayed(a_delayS);
        }

        else
        {
            yield return(new WaitForSeconds(a_delayS));

            PlayClip(a_audioString);
        }
    }
Пример #10
0
    private NarrationData GetShotSavedNarration(PlayInfo _lastPlay)
    {
        NarrationData narData = new NarrationData();

        if (_lastPlay.DefenseExcitment == 0)
        {
            narData.Text = "nar_SaveShot_";
        }
        if (_lastPlay.DefenseExcitment == 1)
        {
            narData.Text = "nar_BestSaveShot_";
        }
        else if (_lastPlay.DefenseExcitment == -1)
        {
            narData.Text = "nar_WorstSaveShot_";
        }

        narData.Variations = 1;
        SetNarrationPlayers(narData, _lastPlay.Defender, _lastPlay.Attacker);
        return(narData);
    }
Пример #11
0
    static void GetNodePosAndRot(PlayInfo info, SampleNode node, out IM.Vector3 pos, out IM.Number horiAngle)
    {
        SampleData sample1 = info.animData.sampleDatas[info.keyFrameIndex1];

        IM.Vector3 pos1   = sample1.nodes[node].position;
        IM.Number  angle1 = sample1.nodes[node].horiAngle;
        if (info.keyFrameIndex1 == info.keyFrameIndex2)
        {
            pos       = pos1;
            horiAngle = angle1;
        }
        else
        {
            SampleData sample2 = info.animData.sampleDatas[info.keyFrameIndex2];
            IM.Vector3 pos2    = sample2.nodes[node].position;
            IM.Number  angle2  = sample2.nodes[node].horiAngle;
            IM.Number  t       = (info.realTime - sample1.time) / (sample2.time - sample1.time);
            pos       = IM.Vector3.Lerp(pos1, pos2, t);
            horiAngle = IM.Math.LerpAngle(angle1, angle2, t);
        }
    }
Пример #12
0
    private PlayInfo GetShotRolls(PlayInfo _currentPlay)
    {
        PlayerData attacker = _currentPlay.Attacker;
        PlayerData defender = _currentPlay.Defender;

        if (defender != null)
        {
            _currentPlay.DefensiveAction      = PlayerAction.Block;
            _currentPlay.DefenderRoll         = ActionRoll.Block(defender);
            _currentPlay.DefendingBonusChance = GetPlayerAttributeBonus(defender.Blocking);
        }

        _currentPlay.AttackerRoll         = ActionRoll.Shoot(attacker);
        _currentPlay.AttackingBonusChance = GetPlayerAttributeBonus(attacker.Shooting);
        if (_currentPlay.Marking == MarkingType.Close)
        {
            _currentPlay.AttackerRoll *= 0.75f;
        }

        return(ApplyBuffs(_currentPlay));
    }
Пример #13
0
    public IEnumerator GetFromWeb()
    {
        UnityWebRequest request;
        string          infoJSON;

        request = UnityWebRequest.Get(webAddress);

        yield return(request.SendWebRequest());

        if (request.isNetworkError)
        {
            Debug.Log(request.error);
        }
        else
        {
            infoJSON   = ((DownloadHandler)request.downloadHandler).text;
            playerInfo = JsonUtility.FromJson <PlayInfo>(infoJSON);
        }

        mm.UpdateInputFields();
    }
Пример #14
0
    private PlayInfo GetDribbleRolls(PlayInfo _currentPlay)
    {
        PlayerData attacker = _currentPlay.Attacker;
        PlayerData defender = _currentPlay.Defender;

        _currentPlay.AttackerRoll         = ActionRoll.Dribble(attacker);
        _currentPlay.AttackingBonusChance = GetPlayerAttributeBonus(attacker.Tackling);
        if (_currentPlay.Marking == MarkingType.Close)
        {
            _currentPlay.AttackerRoll *= 0.75f;
        }

        if (defender != null)
        {
            _currentPlay.DefensiveAction      = PlayerAction.Tackle;
            _currentPlay.DefenderRoll         = ActionRoll.Tackle(defender);
            _currentPlay.DefendingBonusChance = GetPlayerAttributeBonus(defender.Tackling);
        }

        return(ApplyBuffs(_currentPlay));
    }
Пример #15
0
    //更新体力精力恢复时间
    void UpdateVitandVigor()
    {
        PlayInfo info = PlayInfo._instance;

        //体力恢复
        if (info.Vit >= 100)
        {
            vitRecoverTime.text    = "00:00:00";
            vitAllRecoverTime.text = "00:00:00";
        }
        else
        {
            //下一体力恢复
            vitRecoverTime.text = ((int)(60 - info.vitTimer)).ToString();
            //全部体力恢复
            int restVit = 100 - info.Vit; //缺少的体力数
            int sec     = restVit * 60;   //恢复所有体力需要的秒数
            int minshow = sec / 60;       //显示的分钟
            int sceShow = sec % 60;       //显示的分钟数
            vitAllRecoverTime.text = minshow + "分钟";
        }
        //精力恢复
        if (info.Vigor >= 100)
        {
            vigorRecoverTime.text    = "00:00:00";
            vigorAllrecoverTime.text = "00:00:00";
        }
        else
        {
            //下一体力恢复
            vigorRecoverTime.text = ((int)(60 - info.vigorTimer)).ToString();
            //全部体力恢复
            int restVigor = 100 - info.Vigor; //缺少的体力数
            int sec       = restVigor * 60;   //恢复所有体力需要的分钟数
            int minshow   = sec / 60;         //显示的小时
            int sceShow   = sec % 60;         //显示的分钟数
            vigorAllrecoverTime.text = minshow + "分钟";
        }
    }
Пример #16
0
    private PlayInfo ResolveGoal(PlayInfo currentPlay, PlayInfo lastPlay)
    {
        currentPlay = PlayInfo.CopyPlay(lastPlay);

        currentPlay.Attacker.MatchStats.Goals++;
        currentPlay.AttackingTeam.MatchStats.Goals++;
        currentPlay.AttackingTeam.MatchData.Scorers.Add(currentPlay.Attacker);

        if (lastPlay.OffensiveAction == PlayerAction.Header)
        {
            currentPlay.Attacker.MatchStats.GoalsByHeader++;
            currentPlay.AttackingTeam.MatchStats.GoalsByHeader++;
        }

        if (currentPlay.Assister != null)
        {
            currentPlay.Assister.MatchStats.Assists++;
        }

        currentPlay.Event = MatchEvent.GoalAnnounced;
        return(currentPlay);
    }
Пример #17
0
    private PlayInfo ApplyBuffs(PlayInfo _currentPlay)
    {
        PlayerData attacker = _currentPlay.Attacker;
        PlayerData defender = _currentPlay.Defender;

        //Give bonus based on type of marking
        if (_currentPlay.Marking == MarkingType.Close)
        {
            _currentPlay.AttackingBonus *= attackingBonusHigh;
        }
        else if (_currentPlay.Marking == MarkingType.Distance)
        {
            _currentPlay.AttackingBonus *= attackingBonusMedium;
        }
        else if (_currentPlay.Marking == MarkingType.None)
        {
            _currentPlay.AttackingBonus *= attackingBonusLow;
        }
        // In case defender is the Goalkeeper
        if (defender != null && defender.Zone == Zone.OwnGoal)
        {
            _currentPlay.DefenderRoll         = (float)(defender.Goalkeeping + defender.Agility + defender.Vision + defender.Speed) / 400;
            _currentPlay.DefendingBonusChance = GetPlayerAttributeBonus(defender.Goalkeeping);
        }

        //Apply fatigue modifier to attacking stat
        _currentPlay.AttackerRoll *= attacker.FatigueModifier();

        //Apply debuf if player is not assigned to their original position
        if (attacker.IsWronglyAssigned())
        {
            _currentPlay.AttackerRoll *= positionDebuff;
        }

        //Apply attack bonus
        _currentPlay.AttackerRoll *= _currentPlay.AttackingBonus;

        return(_currentPlay);
    }
Пример #18
0
        public PlayViewModel(Play play, TreeViewItemViewModel tvivm)
            : base(tvivm, false)
        {
            this.play = play;

            // 09-15-2010 Scott
            PlayInfo playInfo = new PlayInfo();

            playInfo.Load(play.Path + ".PlayInfo");
            this.playInfo = playInfo;

            FormationViewModel fvm = Parent as FormationViewModel;

            if (fvm != null)
            {
                if (fvm.Image.Contains("Off"))
                {
                    this.Image = AppDomain.CurrentDomain.BaseDirectory + @"Resource\Play.ico";
                }

                if (fvm.Image.Contains("Def"))
                {
                    this.Image = AppDomain.CurrentDomain.BaseDirectory + @"Resource\Play.ico";
                }

                // 10-26-2011 Scott
                if (fvm.Image.Contains("Kick"))
                {
                    this.Image = AppDomain.CurrentDomain.BaseDirectory + @"Resource\Play.ico";
                }
            }
            else
            {
                this.Image = AppDomain.CurrentDomain.BaseDirectory + @"Resource\Play.ico";
            }

            ToolTip = play.Name;
        }
Пример #19
0
        private async Task <ReturnModel <PlayUrlReturnInfo> > Handel23Moe(PlayInfo playInfo, int qn)
        {
            var data = await Get23Moe(playInfo, qn);

            if (data.code == 0)
            {
                var quality = new List <QualityWithPlayUrlInfo>()
                {
                    new QualityWithPlayUrlInfo()
                    {
                        quality             = 80,
                        quality_description = "默认清晰度",
                        playUrlInfo         = new PlayUrlInfo()
                        {
                            url  = data.data,
                            mode = VideoPlayMode.SingleMp4
                        }
                    }
                };
                return(new ReturnModel <PlayUrlReturnInfo>()
                {
                    success = true,
                    data = new PlayUrlReturnInfo()
                    {
                        quality = quality,
                        current = quality[0]
                    }
                });
            }
            else
            {
                return(new ReturnModel <PlayUrlReturnInfo>()
                {
                    success = false,
                    message = data.message
                });
            }
        }
Пример #20
0
    public PlayInfo InterpretPlayString(string a_str, bool b_randClip = false)
    {
        /// Interpret audio string into play information with JSON
        PlayInfo playInfo = default(PlayInfo);

        try {
            playInfo = JsonUtility.FromJson <PlayInfo>(a_str);
        }
        catch (System.Exception e) { Debug.LogError(e.Message + " " + "'" + a_str + "'" + "\n" +
                                                    "NOTE: Audio string must be formatted like: {\"alias\":\"ALIAS\",\"volume\":1}"); };

        // Error checking
        if (playInfo.volume == 0)
        {
            Debug.LogWarning("AUDIO_SYSTEM::Audio clip will be played with a volume of 0: " + a_str);
        }

        // Determine pitch
        playInfo.o_pitch = (playInfo.b_varyPitch) ? Random.Range(playInfo.minPitch, playInfo.maxPitch) : 1f;

        // Determine audio clip
        if (b_randClip)
        {
            // Find and hold onto all audio clips containing the given alias
            List <AudioNode> randClips = AudioFiles.FindAll(clip => clip.alias.Contains(playInfo.alias));

            // Get random index and use it to play a random clip sound with the alias from list
            playInfo.o_clip = randClips[Random.Range(0, randClips.Count())].audio;
        }
        else
        {
            playInfo.o_clip = (AudioFiles.Find(node => node.alias == playInfo.alias)).audio;
            Debug.Assert(playInfo.o_clip, "Attempted to play sound with alias not found in audio files of the AudioSystem: " + playInfo.alias);
        }

        return(playInfo);
    }
Пример #21
0
    public static PlayInfo CopyPlay(PlayInfo _original)
    {
        PlayInfo _play = new PlayInfo();

        _play.Turn = _original.Turn + 1;

        _play.AttackingTeam = _original.AttackingTeam;
        _play.DefendingTeam = _original.DefendingTeam;

        _play.Attacker             = _original.Attacker;
        _play.AttackerRoll         = _original.AttackerRoll;
        _play.AttackingBonusChance = _original.AttackingBonusChance;
        _play.AttackingBonus       = _original.AttackingBonus;
        _play.AttackFatigueRate    = _original.AttackFatigueRate;
        _play.OffensiveAction      = _original.OffensiveAction;
        _play.IsActionSuccessful   = _original.IsActionSuccessful;

        _play.Defender             = _original.Defender;
        _play.DefenderRoll         = _original.DefenderRoll;
        _play.DefendingBonusChance = _original.DefendingBonusChance;
        _play.DefendingBonus       = _original.DefendingBonus;
        _play.DefenseFatigueRate   = _original.DefenseFatigueRate;
        _play.DefensiveAction      = _original.DefensiveAction;
        _play.IsActionDefended     = _original.IsActionDefended;

        _play.Marking          = _original.Marking;
        _play.Event            = _original.Event;
        _play.Assister         = _original.Assister;
        _play.OffenseExcitment = _original.OffenseExcitment;
        _play.DefenseExcitment = _original.DefenseExcitment;
        _play.Zone             = _original.Zone;
        _play.TargetZone       = _original.TargetZone;

        _play.CounterAttack = _original.CounterAttack;

        return(_play);
    }
Пример #22
0
    private PlayInfo GetPassRolls(PlayInfo _currentPlay, PlayInfo _lastPlay)
    {
        PlayerData attacker = _currentPlay.Attacker;
        PlayerData defender = _currentPlay.Defender;

        if (_lastPlay != null && _lastPlay.OffensiveAction == PlayerAction.Cross && _lastPlay.IsActionSuccessful)
        {
            _currentPlay.AttackerRoll = ActionRoll.HeaderPass(attacker);
            if (defender != null)
            {
                _currentPlay.DefensiveAction = PlayerAction.Block;
                _currentPlay.DefenderRoll    = ActionRoll.HeaderBlock(defender);
            }
        }
        else
        {
            _currentPlay.AttackerRoll = ActionRoll.Pass(attacker);
            if (defender != null)
            {
                _currentPlay.DefensiveAction = PlayerAction.Block;
                _currentPlay.DefenderRoll    = ActionRoll.Block(defender);
            }
        }

        _currentPlay.AttackingBonusChance = GetPlayerAttributeBonus(attacker.Passing);

        if (_currentPlay.Marking == MarkingType.Close)
        {
            _currentPlay.AttackingBonusChance = Mathf.FloorToInt(_currentPlay.AttackingBonusChance * 0.9f);
        }
        if (defender != null)
        {
            _currentPlay.DefendingBonusChance = GetPlayerAttributeBonus(defender.Blocking);
        }

        return(ApplyBuffs(_currentPlay));
    }
Пример #23
0
        public static void EachFrame()
        {
            if (1 <= PlayInfos.Count)
            {
                PlayInfo info = PlayInfos.Dequeue();

                if (info != null)
                {
                    switch (info.Command)
                    {
                    case PlayInfo.Command_e.PLAY:
                        DDSoundUtils.Play(info.Music.Sound.GetHandle(0), info.Once, info.Resume);
                        break;

                    case PlayInfo.Command_e.VOLUME_RATE:
                        DDSoundUtils.SetVolume(info.Music.Sound.GetHandle(0), DDSoundUtils.MixVolume(DDGround.MusicVolume, info.Music.Volume) * info.VolumeRate);
                        break;

                    case PlayInfo.Command_e.STOP:
                        DDSoundUtils.Stop(info.Music.Sound.GetHandle(0));

#if true // 再生していたローカルBGMのみ解放する。
                        if (info.Music.Locally)
                        {
                            info.Music.Sound.Unload();
                        }
#else // 全てのローカルBGMを解放する。
                        DDMusicUtils.UnloadLocally();
#endif
                        break;

                    default:
                        throw new DDError();
                    }
                }
            }
        }
Пример #24
0
        public void Load(string userFolder)
        {
            string strRunPlayPath = userFolder + @"\Playbook\Run";

            string strPassPlayPath = userFolder + @"\Playbook\Pass";

            foreach (string strRunPlay in Directory.GetFiles(strRunPlayPath, "*.Play"))
            {
                PlayInfo playInfo = new PlayInfo();

                playInfo.Load(strRunPlay + ".PlayInfo");

                AddPlayInfo(playInfo);
            }

            foreach (string strPassPlay in Directory.GetFiles(strPassPlayPath, "*.Play"))
            {
                PlayInfo playInfo = new PlayInfo();

                playInfo.Load(strPassPlay + ".PlayInfo");

                AddPlayInfo(playInfo);
            }
        }
Пример #25
0
        public async Task <IActionResult> AddPlayList([Bind("Name ,Audio")] PlayInfo p)
        {
            if (ModelState.IsValid)
            {
                //var data = infos.Split();
                string   audioStreaming = p.Audio;
                string   titlesAudio    = p.Name;
                DateTime date1          = DateTime.Now;
                string   email          = HttpContext.Session.GetString("EmailSession");

                PlayListModel playList = new PlayListModel()
                {
                    AudioStream = audioStreaming,
                    titleAudio  = titlesAudio,
                    DateToAdd   = date1,
                    Email       = email
                };
                _context.Add(playList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View());
        }
Пример #26
0
        public PlayInfo GetPlayInfo(TrackInfo trackInfo)
        {
            if (trackInfo == null)
            {
                throw new ArgumentNullException(nameof(trackInfo));
            }

            if (trackInfo.MetaInfo == null)
            {
                throw new TMRIException("Missing MetaInfo in TrackInfo section.");
            }

            if (!trackInfo.MetaInfo.ContainsKey("position"))
            {
                throw new TMRIException("Missing Position definition in TrackInfo.MetaInfo section.");
            }

            var pos = ((JsonElement)trackInfo.MetaInfo["position"]).EnumerateArray()
                      .Select(j => j.GetInt32())
                      .ToList();

            if (pos.Count != 3)
            {
                throw new TMRIException("Invalid Position definition format TrackInfo.MetaInfo section.");
            }


            var result = new PlayInfo
            {
                Start = pos[0],
                Loop  = pos[1] + pos[0],
                End   = pos[2] + pos[0]
            };

            return(result);
        }
Пример #27
0
    private PlayInfo CheckPossesion(PlayInfo _lastPlay, PlayInfo _currentPlay)
    {
        if (_lastPlay.Event == MatchEvent.ShotMissed)
        {
            return(SwitchPossesion(_lastPlay, _currentPlay));
        }
        else if (_lastPlay.Event == MatchEvent.ScorerAnnounced)
        {
            return(SwitchPossesion(_lastPlay, _currentPlay));
        }
        else if (_lastPlay.Event == MatchEvent.Offside)
        {
            return(SwitchPossesion(_lastPlay, _currentPlay));
        }
        else if (_lastPlay.Event == MatchEvent.ShotSaved)
        {
            return(SwitchPossesion(_lastPlay, _currentPlay));
        }
        else if (_lastPlay.Attacker == null)
        {
            return(SwitchPossesion(_lastPlay, _currentPlay));
        }
        else if (_lastPlay.Marking == MarkingType.Steal)
        {
            return(SwitchPossesion(_lastPlay, _currentPlay));
        }
        else if (!_lastPlay.IsActionSuccessful && _lastPlay.Event == MatchEvent.None)
        {
            return(SwitchPossesion(_lastPlay, _currentPlay));
        }

        //NO SWITCH
        _currentPlay.AttackingTeam = _lastPlay.AttackingTeam;
        _currentPlay.DefendingTeam = _lastPlay.DefendingTeam;
        return(_currentPlay);
    }
Пример #28
0
        public override unsafe void WriteTo(ref byte *Buffer)
        {
            base.WriteTo(ref Buffer);

            PlayInfo.WriteTo(ref Buffer);
        }
Пример #29
0
        /// <summary>
        /// 获取活动信息
        /// </summary>
        /// <param name="playId"></param>
        /// <returns></returns>
        public RemotingInterface.PlayInfo GetPlayInfo(int playId)
        {
            RemotingInterface.PlayInfo playInfo = new PlayInfo();
            playInfo.Clear();

            IList<RemotingInterface.PlayInfo> _list = new List<PlayInfo>();
            _list = GetPlayList();
            _list = (from row in _list
                     where row.PlayId == playId
                     select row).ToList<RemotingInterface.PlayInfo>();
            if (_list.Count == 1)
            {
                playInfo = _list[0];
            }
            return playInfo;
        }
Пример #30
0
 public void SpawnAgent(PlayInfo playInfo, int nodeIndex)
 {
     enemyFaction.SpawnEnemyCharacter(playInfo, nodeIndex);
 }
Пример #31
0
        private async Task <ApiDataModel <DashModel> > GetBiliBiliDash(PlayInfo playInfo, int qn)
        {
            try
            {
                var api = PlayerAPI.VideoPlayUrl(aid: playInfo.avid, cid: playInfo.cid, qn: qn, true);
                if (playInfo.play_mode == VideoPlayType.Season)
                {
                    api = PlayerAPI.SeasonPlayUrl(aid: playInfo.avid, cid: playInfo.cid, qn: qn, season_type: playInfo.season_type, true);
                }
                var result = await api.Request();

                if (result.status)
                {
                    DashModel dashModel = null;
                    var       obj       = result.GetJObject();
                    if (obj["code"].ToInt32() != 0 || result.results.Contains("8986943"))
                    {
                        return(await GetBiliPlusDash(playInfo, qn));
                    }
                    if (obj.ContainsKey("data"))
                    {
                        dashModel = JsonConvert.DeserializeObject <DashModel>(obj["data"].ToString());
                    }
                    if (obj.ContainsKey("result") && obj["result"].ToString() != "suee")
                    {
                        dashModel = JsonConvert.DeserializeObject <DashModel>(obj["result"].ToString());
                    }
                    if (obj.ContainsKey("dash"))
                    {
                        dashModel = JsonConvert.DeserializeObject <DashModel>(obj.ToString());
                    }
                    //var data = await result.GetJson<ApiDataModel<DashModel>>();
                    //if (data.code != 0 || result.results.Contains("8986943"))
                    //{
                    //    return await GetBiliPlusDash(playInfo, qn);
                    //}

                    if (dashModel == null)
                    {
                        dashModel = await result.GetJson <DashModel>();
                    }
                    if (dashModel.dash == null)
                    {
                        return(new ApiDataModel <DashModel>()
                        {
                            code = -910,
                            message = "需要使用FLV"
                        });
                    }
                    return(new ApiDataModel <DashModel>()
                    {
                        code = 0,
                        data = dashModel
                    });
                }
                else
                {
                    if (playInfo.play_mode == VideoPlayType.Season)
                    {
                        return(await GetBiliPlusDash(playInfo, qn));
                    }
                    return(new ApiDataModel <DashModel>()
                    {
                        code = -998,
                        message = result.message
                    });
                }
            }
            catch (Exception ex)
            {
                var data = HandelError <object>(ex);
                return(new ApiDataModel <DashModel>()
                {
                    code = -999,
                    message = data.message
                });
            }
        }
Пример #32
0
        private async Task <ApiDataModel <FlvModel> > GetBiliBiliFlv(PlayInfo playInfo, int qn)
        {
            try
            {
                var api = PlayerAPI.VideoPlayUrl(aid: playInfo.avid, cid: playInfo.cid, qn: qn, false);
                if (playInfo.play_mode == VideoPlayType.Season)
                {
                    api = PlayerAPI.SeasonPlayUrl(aid: playInfo.avid, cid: playInfo.cid, qn: qn, season_type: playInfo.season_type, false);
                }
                var result = await api.Request();

                if (result.status)
                {
                    var      obj     = result.GetJObject();
                    FlvModel flvData = null;
                    if (obj["code"].ToInt32() != 0 || result.results.Contains("8986943"))
                    {
                        var bp = await GetBiliPlusFlv(playInfo, qn);

                        return(new ApiDataModel <FlvModel>()
                        {
                            code = bp.code,
                            message = bp.message,
                            data = bp.data
                        });
                    }
                    if (obj["data"] != null)
                    {
                        flvData = JsonConvert.DeserializeObject <FlvModel>(obj["data"].ToString());
                    }
                    if (obj["result"] != null && obj["result"].ToString() != "suee")
                    {
                        flvData = JsonConvert.DeserializeObject <FlvModel>(obj["result"].ToString());
                    }
                    if (obj["durl"] != null)
                    {
                        flvData = JsonConvert.DeserializeObject <FlvModel>(obj.ToString());
                    }
                    return(new ApiDataModel <FlvModel>()
                    {
                        code = 0,
                        message = "",
                        data = flvData
                    });
                    //var data = await result.GetJson<ApiDataModel<FlvModel>>();
                    //if (data.code != 0|| result.results.Contains("8986943"))
                    //{

                    //    //return await GetBiliPlusFlv(playInfo, qn);
                    //}
                    //if (data.data == null)
                    //{
                    //    data.data = await result.GetJson<FlvModel>();
                    //}
                    //return data;
                }
                else
                {
                    if (playInfo.play_mode == VideoPlayType.Season)
                    {
                        var bp = await GetBiliPlusFlv(playInfo, qn);

                        return(new ApiDataModel <FlvModel>()
                        {
                            code = bp.code,
                            message = bp.message,
                            data = bp.data
                        });
                    }
                    return(new ApiDataModel <FlvModel>()
                    {
                        code = -998,
                        message = result.message
                    });
                }
            }
            catch (Exception ex)
            {
                var data = HandelError <object>(ex);
                return(new ApiDataModel <FlvModel>()
                {
                    code = -999,
                    message = data.message
                });
            }
        }
Пример #33
0
        public async Task <ReturnModel <PlayUrlReturnInfo> > GetPlayUrls(PlayInfo playInfo, int qn)
        {
            try
            {
                var mode = SettingHelper.GetValue <int>(IsDownload ? SettingHelper.Download.DEFAULT_VIDEO_TYPE : SettingHelper.Player.DEFAULT_VIDEO_TYPE, 1);
                if (mode == 0)
                {
                    var data = await HandelFlv(playInfo, qn);

                    if (data.success)
                    {
                        return(data);
                    }
                    data = await HandelGrpcFlv(playInfo, qn);

                    if (data.success)
                    {
                        return(data);
                    }
                    data = await HandelDash(playInfo, qn, mode);

                    if (data.success)
                    {
                        return(data);
                    }
                    data = await HandelGrpcDash(playInfo, qn, mode);

                    if (data.success)
                    {
                        return(data);
                    }
                    if (!data.success && playInfo.play_mode == VideoPlayType.Season && SettingHelper.GetValue <bool>(SettingHelper.Player.USE_OTHER_SITEVIDEO, false))
                    {
                        data = await Handel23Moe(playInfo, qn);
                    }
                    return(data);
                }
                else
                {
                    var data = await HandelDash(playInfo, qn, mode);

                    if (data.success)
                    {
                        return(data);
                    }
                    data = await HandelGrpcDash(playInfo, qn, mode);

                    if (data.success)
                    {
                        return(data);
                    }
                    data = await HandelFlv(playInfo, qn);

                    if (data.success)
                    {
                        return(data);
                    }
                    data = await HandelGrpcFlv(playInfo, qn);

                    if (data.success)
                    {
                        return(data);
                    }
                    if (!data.success && playInfo.play_mode == VideoPlayType.Season && SettingHelper.GetValue <bool>(SettingHelper.Player.USE_OTHER_SITEVIDEO, false))
                    {
                        data = await Handel23Moe(playInfo, qn);
                    }
                    return(data);
                }
            }
            catch (Exception ex)
            {
                return(HandelError <PlayUrlReturnInfo>(ex));
            }
        }
Пример #34
0
 // Use this for initialization
 //public static PlayInfo GetInstance() {
 //    //_instance = _instance ?? new PlayInfo();
 //    //return _instance;
 //    if (_instance == null) {
 //        _instance = new PlayInfo();
 //    }
 //    return _instance;
 //}
 void Awake()
 {
     _instance = this;
 }
Пример #35
0
      /**************************************************************************************************/
      /*!
       *    \fn      public void Play(AudioClip audioClip, bool sameCheck, float livingTime, float volume)
       *             SE としての OneShot 再生 (AudioClip指定版)
       *    \remarks Donuts.Sound.Status.IsMuteSE や Donuts.Sound.Status.IsPause が true の場合は再生しません(再生履歴生存リストにも登録しません)
       *             再生した場合は、AudioClip の名前を再生履歴生存リストにも登録して、指定した秒数リストに残り続けて、同じ音を連続再生する場合に後に再生した再生をキャンセルするようにしています
       *    \param   audioClip  : 再生する AudioClip
       *		\param   sameCheck  : 連続再生時除外チェックをするか
       *    \param   livingTime : 再生履歴生存時間(この秒数リストに残り続けて、sameCheck が ON の時にリストにあったら再生しないようにします)
       *    \param   volume     : 再生ボリューム、特に無い場合は 1.0f を指定してください
       *    \date    2014.12.25(Thu)
       *    \author  Masayoshi.Matsuyama@Donuts
       */
      /**************************************************************************************************/
			public void Play(AudioClip audioClip, bool sameCheck=false, float livingTime=0.0f, float volume = 1.0f) {
				if (audioClip == null) {
					Donuts.Sound.Utility.debPrintError("ERROR:Sound.OneShotPlay.Play audioClip is null.");
					return;
				}
				Create();

				// ポーズ中なら抜ける
				if (Donuts.Sound.Status.IsPause) return;
				// ミュート中なら抜ける
				if (Donuts.Sound.Status.IsMuteSE) return;	

				// 連続再生時除外チェックをするか?		
				if (sameCheck) {
					// 再生履歴生存リストに、その音はいるか?
					if (searchPlayInfoList(audioClip.name) != null) {
						// ちょっと前に同じ音が再生されていたので、追加で再生しないで抜けます
						Donuts.Sound.Utility.debPrint("Sound.OneShotPlay.Play already play same SE. "+audioClip.name);
						return;
					}
				}

				// 再生履歴生存時間が0.0fより大きいなら、再生履歴生存リストに登録します
				if (livingTime > 0.0f) {
					PlayInfo info = new PlayInfo(audioClip.name, livingTime);
					playInfoList.Add(info);
				}

				// 再生
				audioSrcObj.PlayOneShot(audioClip, volume * Donuts.Sound.Status.BaseVolumeSE);
				Donuts.Sound.Utility.debPrint("OneShotPlay.Play:"+audioClip.name);			
			}
Пример #36
0
 public void PlayInfoChangedChanged(PlayInfo.InfoType infoType)
 {
     if (infoType == PlayInfo.InfoType.All || infoType == PlayInfo.InfoType.Name || infoType == PlayInfo.InfoType.Level || infoType == PlayInfo.InfoType.HeadTrait || infoType == PlayInfo.InfoType.Energy) {
         UpDateShow();
     }
 }
Пример #37
0
 void OnPlayInfoChanged(PlayInfo.InfoType type)
 {
     if (type == PlayInfo.InfoType.All || type == PlayInfo.InfoType.Energy || type == PlayInfo.InfoType.Toughen) {
         UpDateShow();
     }
 }
Пример #38
0
 public MainPanel(PlayInfo info)
     : this(info, false)
 {
 }