Ejemplo n.º 1
0
        private void SaveShot()
        {
            ShotMetaInfo metaInfo = new ShotMetaInfo();

            metaInfo.Name = txtShotName.Text;
            if (string.IsNullOrEmpty(metaInfo.Name) || metaInfo.Name == strPromptNewShotName)
            {
                metaInfo.Name = "Noname" + BallTrackAPI.shotHistory.Shot.Count.ToString("##");
            }

            metaInfo.Description = txtShotDescription.Text;
            if (metaInfo.Description == "Description of shot")
            {
                metaInfo.Description = "";
            }

            metaInfo.nPlayer = BallTrackAPI.m_nCurrentPlayer;
            metaInfo.nShot   = metaInfo.nPlayer == 0 ? BallTrackAPI.BTAPI_GetWhiteHistoryCount() : BallTrackAPI.BTAPI_GetYellowHistoryCount();
            metaInfo.nShot--;

            for (int i = 0; i < 28; i++)
            {
                metaInfo.lstRailMarkValue.Add(BallTrackAPI.m_nMarkValue[i]);
            }

            metaInfo.InSide  = BallTrackAPI.m_nInSide;
            metaInfo.OutSide = BallTrackAPI.m_nOutSide;

            BallTrackAPI.shotHistory.Shot.Add(metaInfo);
            BallTrackAPI.SaveShotHistory(lblTeacherName.Text);
        }
Ejemplo n.º 2
0
        private void btnReplay_Click(object sender, EventArgs e)
        {
            BLL_BilliardWindowsApplication.playclicksound();
            if (m_bUploadMode && m_bShotFinished)
            {
                UpdateButtonState(TeachingState.Replay);
                int nShotCount = BallTrackAPI.m_nCurrentPlayer == 0 ? BallTrackAPI.BTAPI_GetWhiteHistoryCount() : BallTrackAPI.BTAPI_GetYellowHistoryCount();
                BallTrackAPI.m_bReplay = true;
                nReplayPlayer          = BallTrackAPI.m_nCurrentPlayer;
                ShowTeacherControls(false);
                BallTrackAPI.BTAPI_DrawReplay(IntPtr.Zero, BallTrackAPI.m_nCurrentPlayer, nShotCount - 1);
            }
            else
            {
                int nShotNum = cmbShotHistory.SelectedIndex;
                if (nShotNum >= 0)
                {
                    UpdateButtonState(TeachingState.Replay);
                    ShowTeacherControls(false);
                    ShotMetaInfo shot = BallTrackAPI.shotHistory.Shot[nShotNum];
                    nReplayPlayer          = shot.nPlayer;
                    BallTrackAPI.m_bReplay = true;

                    if (shot.lstRailMarkValue.Count == 28)
                    {
                        for (int i = 0; i < 28; i++)
                        {
                            BallTrackAPI.m_nMarkValue[i] = shot.lstRailMarkValue[i];
                        }
                    }
                    BallTrackAPI.m_nInSide  = shot.InSide;
                    BallTrackAPI.m_nOutSide = shot.OutSide;

                    LoadTeacherSetting();

                    BallTrackAPI.BTAPI_DrawReplay(IntPtr.Zero, shot.nPlayer, shot.nShot);
                }
            }
            timerDraw.Enabled = true;
        }