Example #1
0
        private async Task AddRoundToPlaylist(string roundName, string matchName)
        {
            MatchData matchData = await DB.GetData <MatchData>(matchName);

            RoundData roundData = await DB.GetData <RoundData>(roundName);

            if (matchData.YoutubeUrl == null || roundData.YoutubeUrl == null)
            {
                Console.WriteLine($"Could not add round {roundData.Name} to playlist because either match url or round url are missing");
                await Task.CompletedTask;
                return;
            }

            int roundIndex = matchData.Rounds.IndexOf(roundData.Name);

            try
            {
                Console.WriteLine($"Adding {roundData.Name} to playlist {matchData.Name}");
                PlaylistItem roundPlaylistItem = await GetPlaylistItemForRound(roundData);

                roundPlaylistItem.Snippet.Position   = roundIndex + 1;
                roundPlaylistItem.Snippet.PlaylistId = matchData.YoutubeUrl;
                await Service.PlaylistItems.Insert(roundPlaylistItem, "snippet").ExecuteAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        private void pbTheImage_MouseDown(object sender, MouseEventArgs e)
        {
            PointD ptRealPosition = ((PictureBox)sender).GetMouseEventPositionOnRealImage(e, origImage);

            ThreadSafeOperations.SetText(lblTitle, ptRealPosition.ToString() + "  down  " + currMouseActionRegime, false);

            ptMouseDown = ptRealPosition;
            switch (ptRealPosition.IsPointInsideCircle(sunDiskPositionAndSize, 10.0d))
            {
            case -1:
                currMouseActionRegime = MouseActionsRegime.DrawingSunDisk;
                break;

            case 0:
                currMouseActionRegime = MouseActionsRegime.ResizingSunDisk;
                sunDiskPositionAndSizeBeforeMovingResizing = sunDiskPositionAndSize.Copy();
                break;

            case 1:
                currMouseActionRegime = MouseActionsRegime.MovingSunDisk;
                sunDiskPositionAndSizeBeforeMovingResizing = sunDiskPositionAndSize.Copy();
                break;

            default:
                break;
            }
        }
Example #3
0
        private async Task AddYoutubeIdToRound(string roundName, string videoId)
        {
            RoundData roundData = await DB.GetData <RoundData>(roundName);

            roundData.YoutubeUrl = videoId;
            await DB.SaveData(roundData);
        }
Example #4
0
        private async Task AddRoundToPlaylist(string roundName)
        {
            RoundData roundData = await DB.GetData <RoundData>(roundName);

            MatchData matchData = await DB.GetData <MatchData>(roundData.MatchName);

            if (matchData == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(matchData.YoutubeUrl))
            {
                Console.WriteLine($"Created playlist for {matchData.DatabaseIndex}");
                await CreatePlaylist(roundData.MatchName);
            }

            matchData = await DB.GetData <MatchData>(roundData.MatchName);

            //wasn't created, still null
            if (string.IsNullOrEmpty(matchData.YoutubeUrl))
            {
                return;
            }

            await AddRoundToPlaylist(roundName, roundData.MatchName);
        }
Example #5
0
        protected override bool Execute(CodeActivityContext context)
        {
            List <string> _ListAisId = ListAisId.Get(context);
            bool          roundData  = RoundData.Get(context);

            if (_ListAisId == null || _ListAisId.Count == 0)
            {
                Error.Set(context, "Список идентификаторов АИС не может быть пустым");
                return(false);
            }

            try
            {
                XMLATSExportSingleObjectResultCompressed Res = ARM_Service.XMLExportGetAIS80020Ext(StartDateTime.Get(context), EndDateTime.Get(context), _ListAisId, DataSourceType, isReadCalculatedValues, roundData, false, false, false, 1, true);
                if (!string.IsNullOrEmpty(Res.Errors))
                {
                    Error.Set(context, Res.Errors);
                }

                Document.Set(context, Res.XMLStreamCompressed);
            }

            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            return(string.IsNullOrEmpty(Error.Get(context)));
        }
Example #6
0
        private async Task RemoveRoundVideoFile(string roundName)
        {
            RoundData roundData = await DB.GetData <RoundData>(roundName);

            //don't accidentally delete stuff that somehow doesn't have a url set
            if (roundData.YoutubeUrl == null)
            {
                return;
            }

            try
            {
                string filePath          = DB.SharedSettings.GetRoundVideoPath(roundName);
                string reEncodedFilePath = Path.ChangeExtension(filePath, "converted.mp4");

                if (File.Exists(filePath))
                {
                    Console.WriteLine("Removed video file for {0}", roundName);
                    File.Delete(filePath);
                }

                if (File.Exists(reEncodedFilePath))
                {
                    Console.WriteLine("Also removing the reencoded version {0}", roundName);
                    File.Delete(reEncodedFilePath);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #7
0
        protected override bool Execute(CodeActivityContext context)
        {
            string         _AisId     = AisId.Get(context);
            DateTimeOffset _EventDate = EventDate.Get(context);
            bool           roundData  = RoundData.Get(context);

            if (string.IsNullOrEmpty(_AisId))
            {
                Error.Set(context, "Идентификатор АИС не может быть пустым");
                return(false);
            }

            try
            {
                XMLATSExportSingleObjectResultCompressed Res = ARM_Service.XMLExportGetAIS80020(_EventDate, _AisId, DataSourceType, isReadCalculatedValues, roundData, false, false, false, false, 1, true);
                if (!string.IsNullOrEmpty(Res.Errors))
                {
                    Error.Set(context, Res.Errors);
                }

                Document.Set(context, Res.XMLStreamCompressed);
            }

            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            return(string.IsNullOrEmpty(Error.Get(context)));
        }
Example #8
0
    public static List <RoundData> ReadExcel(string ePath)
    {
        List <RoundData> list = new List <RoundData>();

        using (FileStream stream = File.Open(excelPath, FileMode.Open, FileAccess.Read, FileShare.Read))
        {
            using (IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream))
            {
                excelReader.Read();
                for (int i = 1; i < excelReader.RowCount; i++)
                {
                    excelReader.Read();
                    RoundData rdata = new RoundData();
                    rdata.enemyList = new List <int>();
                    rdata.pathList  = new List <Vector3>();
                    rdata.levelID   = int.Parse(excelReader.GetString(0));
                    rdata.index     = int.Parse(excelReader.GetString(1));
                    string[] enemyStrArr = excelReader.GetString(2).Split(',');
                    for (int j = 0; j < enemyStrArr.Length; j++)
                    {
                        rdata.enemyList.Add(int.Parse(enemyStrArr[j]));
                    }
                    string[] pathStrArr = excelReader.GetString(3).Split(',');
                    for (int k = 0; k < pathStrArr.Length; k++)
                    {
                        rdata.pathList.Add(PathPointRecord.instance.pathList[int.Parse(pathStrArr[k])]);
                    }
                    list.Add(rdata);
                }
            }
        }
        return(list);
    }
        private async Task <List <string> > GetEligibleMatchNames()
        {
            var concMatches = new ConcurrentBag <MatchData>();

            await DB.IterateOverAll <MatchData>(async ( matchData ) =>
            {
                bool suitable = matchData.VideoType == VideoType.PlaylistLink && string.IsNullOrEmpty(matchData.YoutubeUrl) && !File.Exists(DB.SharedSettings.GetMatchVideoPath(matchData.Name)) && matchData.Rounds.Count > 1;

                if (suitable)
                {
                    foreach (var roundName in matchData.Rounds)
                    {
                        RoundData roundData = await DB.GetData <RoundData>(roundName);

                        if (roundData.RecordingType != RecordingType.Video || !string.IsNullOrEmpty(roundData.YoutubeUrl) || !File.Exists(DB.SharedSettings.GetRoundVideoPath(roundName)))
                        {
                            suitable = false;
                            break;
                        }
                    }
                }

                if (suitable)
                {
                    concMatches.Add(matchData);
                }
                return(true);
            });

            return(concMatches.OrderBy(x => x.TimeStarted).Select(x => x.DatabaseIndex).ToList());
        }
    // Use this for initialization
    void Start()
    {
        //Test Questions

        dataController = dataController = FindObjectOfType <DataController>();

        isEditing = dataController.getisEditig();

        if (isEditing)
        {
            RoundData data = dataController.GetCurrentRoundData();

            QuestionData[] questionsData = data.questions;

            questionList = new List <QuestionData>(questionsData);
            loadQuestion(0);
        }
        else
        {
            questionInput.text = "What is my name?";

            answerA.text = "Tim";
            answerB.text = "John";
            answerC.text = "Barry";
            answerD.text = "Ben";

            togA.isOn = true;
            togB.isOn = false;
            togC.isOn = false;
            togD.isOn = false;
        }
        currentQuestionViewing = 0;
    }
    public void saveQuiz()
    {
        GameData  gameData = new GameData();
        RoundData roundData;

        if (isEditing)
        {
            roundData = dataController.GetCurrentRoundData();
        }
        else
        {
            roundData = dataController.addRoundData;
        }

        roundData.questions = questionList.ToArray();

        gameDataProjectFilePath = "/StreamingAssets/" + roundData.name + ".json";

        RoundData[] roundDataArray = new RoundData[1];
        roundDataArray[0]     = roundData;
        gameData.allRoundData = roundDataArray;


        string dataAsJson = JsonUtility.ToJson(gameData);
        string filePath   = Application.dataPath + gameDataProjectFilePath;

        File.WriteAllText(filePath, dataAsJson);
        StartCoroutine(UploadQuizToDatabase(filePath));
    }
        private void ChangeSunDiskData(PointD ptCurrMousePosition)
        {
            if (ptMouseDown != ptCurrMousePosition) // not just click
            {
                switch (currMouseActionRegime)
                {
                case MouseActionsRegime.Nothing:
                    break;

                case MouseActionsRegime.DrawingSunDisk:
                    sunDiskPositionAndSize = new RoundData(ptMouseDown.X, ptMouseDown.Y,
                                                           ptMouseDown.Distance(ptCurrMousePosition));

                    break;

                case MouseActionsRegime.MovingSunDisk:
                    sunDiskPositionAndSize.DCenterX = sunDiskPositionAndSizeBeforeMovingResizing.DCenterX + (ptCurrMousePosition.X - ptMouseDown.X);
                    sunDiskPositionAndSize.DCenterY = sunDiskPositionAndSizeBeforeMovingResizing.DCenterY + (ptCurrMousePosition.Y - ptMouseDown.Y);

                    break;

                case MouseActionsRegime.ResizingSunDisk:
                    sunDiskPositionAndSize.DRadius =
                        ptCurrMousePosition.Distance(sunDiskPositionAndSize.pointDCircleCenter());

                    break;

                default:
                    break;
                }
            }
        }
    public void ShowQuestion()
    {
        RoundData currentRoundData = dataController.GetCurrentRoundData(round);

        QuestionData[] questionPool = currentRoundData.questions;
        QuestionData   questionData = questionPool[questionIndex];

        categoryDisplay.SetActive(false);
        questionDisplay.SetActive(true);
        questionText.text = questionData.questionText;
        for (int i = 0; i < answerButtons.Length; i++)
        {
            AnswerData answerData = new AnswerData();
            answerData.answerText = questionData.answers[i].answerText;
            answerData.isCorrect  = questionData.answers[i].isCorrect;
            answerButtons[i].Setup(answerData);
            if (i == 0)
            {
                answerAText.text = answerData.answerText;
            }
            if (i == 1)
            {
                answerBText.text = answerData.answerText;
            }
            if (i == 2)
            {
                answerCText.text = answerData.answerText;
            }
            if (i == 3)
            {
                answerDText.text = answerData.answerText;
            }
        }
    }
Example #14
0
    string getRoundTypeIcon(RoundData rd)
    {
        switch (rd.mode)
        {
        case RoundData.MODE.KILLEMALL: return("img_epicmode_kill");        // 섬멸

        case RoundData.MODE.SURVIVAL: return("img_epicmode_survival");     // 서바이벌

        case RoundData.MODE.PROTECT: return("img_epicmode_protect");       // 보허

        case RoundData.MODE.SNIPING: return("img_epicmode_sniping");       //보스대전

        case RoundData.MODE.KILLCOUNT: return("img_epicmode_killcount");   //몬스터 사냥

        case RoundData.MODE.KILLCOUNT2: return("img_epicmode_killcount");

        case RoundData.MODE.ARRIVE: return("img_epicmode_arrive");

        case RoundData.MODE.DESTROY: return("img_epicmode_destroy");

        case RoundData.MODE.GETITEM: return("img_epicmode_getitem");

            break;
        }

        return("");
    }
Example #15
0
        // Updaterar information om runda i tabellena Round & RoundStat genom en lagrad procedur
        public void UpdateRoundData(RoundData roundData)
        {
            using (var conn = CreateConnection())
            {
                try
                {
                    var cmd = new SqlCommand("app.usp_updateRoundData", conn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add("@RoundID", SqlDbType.Int).Value       = roundData.RoundID;
                    cmd.Parameters.Add("@Name", SqlDbType.VarChar, 30).Value  = roundData.Name;
                    cmd.Parameters.Add("@Date", SqlDbType.Date).Value         = roundData.Date;
                    cmd.Parameters.Add("@GIR", SqlDbType.TinyInt).Value       = roundData.GIR;
                    cmd.Parameters.Add("@FIR", SqlDbType.TinyInt).Value       = roundData.FIR;
                    cmd.Parameters.Add("@Putts", SqlDbType.TinyInt).Value     = roundData.Putts;
                    cmd.Parameters.Add("@Penalties", SqlDbType.TinyInt).Value = roundData.Penalties;
                    cmd.Parameters.Add("@Strokes", SqlDbType.TinyInt).Value   = roundData.Strokes;

                    conn.Open();

                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    throw new ApplicationException("Ett fel har uppstått vid uppdateringen av rundan i databasen.");
                }
            }
        }
Example #16
0
        protected override bool Execute(CodeActivityContext context)
        {
            List <int> ps_id_List = ListPsId.Get(context);
            DateTime   _EventDate = EventDate.Get(context);
            bool       roundData  = RoundData.Get(context);

            if (ps_id_List == null || ps_id_List.Count == 0)
            {
                Error.Set(context, "Список ПС не может быть пустым");
                return(false);
            }

            try
            {
                Stream Res = ARM_Service.XMLExportGetPS80020ForPSArray(_EventDate, ps_id_List, DataSourceType, requiredATSCode, isReadCalculatedValues, roundData, false, UTCTimeShiftFromMoscow, false, false, 1, true).XMLStream;

                MemoryStream ms = new MemoryStream();
                Res.CopyTo(ms);
                ms.Position = 0;

                Document.Set(context, ms);
            }

            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            return(string.IsNullOrEmpty(Error.Get(context)));
        }
Example #17
0
    public void EndRound()
    {
        if (roundNum < dataController.allRoundData.Length - 1)
        {
            roundNum++;
            roundData     = dataController.GetCurrentRoundData(roundNum);
            questionIndex = 0;
            questionData  = roundData.questions;
            ShowQuestions();
            timer         = roundData.timeLimitInSeconds;
            isRoundActive = true;
        }
        else
        {
            isRoundActive     = false;
            endScoreText.text = ": " + playerScore;

            initialField.Select();
            questionDisplay.SetActive(false);
            if (dataController.socket.socket.IsConnected)
            {
                highScoreDisplay.SetActive(true);
            }
            else
            {
                endGameDisplay.SetActive(true);
            }
        }
    }
        internal Response_PvE_EnterDungeon(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                RoundData round = new RoundData();
                round.RoundId = packet.GetInt32();
                round.Name = packet.GetStringFromUtf16();
                round.IsBossRound = packet.GetBoolean();
                round.Monsters = new List<MonsterData>();
                Rounds.Add(round);

                Int32 monsterCount = packet.GetInt32();
                while (monsterCount-- > 0)
                {
                    MonsterData monster = new MonsterData();
                    monster.MonsterNo = packet.GetInt32();
                    monster.MonsterId = packet.GetInt32();
                    monster.Name = packet.GetStringFromUtf16();
                    monster.GradeId = packet.GetInt32();
                    monster.PromotionId = packet.GetInt32();
                    monster.Level = packet.GetInt32();
                    round.Monsters.Add(monster);
                }
            }
        }
    public void AnswerButtonClicked(bool isCorrect)
    {
        RoundData currentRoundData = dataController.GetCurrentRoundData(round);

        QuestionData[] questionPool = currentRoundData.questions;
        if (isCorrect)
        {
            playerScore      += currentRoundData.pointsAddedForCorrectAnswer;
            scoreText.text    = "Score: " + playerScore.ToString();
            questionText.text = "Correct!";
        }
        else
        {
            questionText.text = "Wrong!";
        }

        if (questionPool.Length > questionIndex + 1)
        {
            StartCoroutine(Wait());
            questionIndex++;
        }
        else
        {
            StartCoroutine(EndRound());
        }
    }
Example #20
0
    //Ghilman

    /// <summary>
    /// this function will set the values for this object
    /// </summary>
    /// <param name="_itemData"></param>
    /// <param name="_isHistory"></param>
    public void SetItemData(RoundData _itemData, bool _isHistory, int _indexInDumyFavorite)
    {
        roundData           = _itemData;
        isHistory           = _isHistory;
        indexInDumyFavorite = _indexInDumyFavorite;

        string[] srtingParts  = roundData.mSenence.Split("_"[0]);
        string   stringToShow = srtingParts[0];

        mainText.text = stringToShow + " <color=Blue>" + roundData.mAnswer + "</color> " + srtingParts[srtingParts.Length - 1];

        //Ghilman
        if (GameManager.Instance.menuManager.previousState == UIManager.State.MainMenu)
        {
            favoriteToggle.enabled = true;
            if (_isHistory)
            {
            }
            else
            {
                favoriteToggle.isOn = true;
            }
        }
        else
        {
            Debug.Log("there is a other thing not main menu");
        }
        //Ghilman
    }
Example #21
0
    private void InitRound()
    {
        // In case of coming from another scene
        playerScore           = PlayerPrefs.GetInt(CURRENT_PLAYER_SCORE_PREF);
        scoreDisplayText.text = playerScore.ToString();

        while (!dataController.isQuestionSetLoaded() || !dataController.isLearning())
        {
            ;
        }

        questionDisplay.SetActive(true);
        roundEndDisplay.SetActive(false);

        currentQuestionSet = dataController.GetCurrentQuestionSet();
        currentAnswers     = new ArrayList();
        questionPool       = currentQuestionSet.questions;

        ResetTimeRemainingDisplay();
        UpdateTimeRemainingDisplay();

        questionIndex = 0;
        ShowQuestion();
        isRoundActive = true;

        questionDisplayBackgroundColor = new Color32(0, 0, 0, OBAQUE_VALUE);
    }
Example #22
0
 protected override async Task OnInitializedAsync()
 {
     subscription = () => {
         InvokeAsync(() => {
             data = Cache.Cache;
             if (roundId >= data.Cache.Rounds.Count)
             {
                 roundId = 0;
             }
             if (roundId < data.Cache.Rounds.Count)
             {
                 currentRound = data.Cache.Rounds[roundId];
             }
             else
             {
                 currentRound = new RoundData();
             }
             if (page >= (SearchResult.Count() + 100 - 1) / 100)
             {
                 page = 0;
             }
             StateHasChanged();
         });
     };
     Cache.CacheUpdated += subscription;
     subscription();
 }
Example #23
0
    // Use this for initialization
    void Start()
    {
        dataController   = FindObjectOfType <DataController> ();
        currentRoundData = dataController.GetCurrentRoundData();
        questionPool     = currentRoundData.questions;
        timeRemaining    = currentRoundData.timeLimitInSeconds;
        UpdateTimeRemainingDisplay();

        playerScore   = 0;
        wrongScoreInt = 0;

        //Set the list
        List <int> questionsAsked = new List <int>();

        //Get a random number for the initial index value, and add it to the array
        questionIndex   = Random.Range(0, questionPool.Length);
        questionCounter = 0;
        Debug.Log(questionIndex);

        questionAudioSource.pitch = (float)1.00;

        //animg = good.GetComponent<Animator>();
        //animb = bad.GetComponent<Animator>();

        ShowQuestion();
        isRoundActive = true;
    }
Example #24
0
    void OnReceive(SocketIOEvent e)
    {
        gameData = e.data;

        roundData = new RoundData();

        roundData.name = GetStringFromJson(gameData, "name");
        roundData.timeLimitInSeconds          = GetIntFromJson(gameData, "timeLimitInSeconds");
        roundData.pointsAddedForCorrectAnswer = GetIntFromJson(gameData, "pointsAddedForCorrectAnswer");

        questionSize        = gameData["questions"].Count;
        roundData.questions = new QuestionData[questionSize];

        for (int x = 0; x < questionSize; x++)
        {
            roundData.questions[x] = new QuestionData();

            roundData.questions[x].questionText = GetStringFromJson(gameData["questions"].list[x], "questionText");

            answerSize = gameData["questions"].list[x].GetField("answers").Count;
            roundData.questions[x].answers = new AnswerData[answerSize];

            for (int y = 0; y < answerSize; y++)
            {
                roundData.questions[x].answers[y] = new AnswerData();

                roundData.questions[x].answers[y].answerText = GetStringFromJson(gameData["questions"].list[x].GetField("answers").list[y], "answerText");
                roundData.questions[x].answers[y].isCorrect  = GetBoolFromJson(gameData["questions"].list[x].GetField("answers").list[y], "isCorrect");
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     dataController = FindObjectOfType <DataController>();
     roundNumber    = DataController.roundNumber;
     roundData      = dataController.GetAllRoundData(roundNumber);
     portraitPlace.GetComponent <Image>().sprite = roundData.playerSprite;
     sizePlace.GetComponent <Text>().text        = roundData.freeSpace.ToString();
     if (roundData.gb == true)
     {
         formatPlace.GetComponent <Text>().text = "GB";
         b = (roundData.freeSpace) * 1048576;
     }
     if (roundData.mb == true)
     {
         formatPlace.GetComponent <Text>().text = "MB";
         b = (roundData.freeSpace) * 1024;
     }
     if (roundData.b == true)
     {
         formatPlace.GetComponent <Text>().text = "KB";
         b = (roundData.freeSpace);
     }
     actualSizeStart = b;
     Invoke("ComponentsSet", 0.3f);
     // obliczy bajty zey byly potem do updatow
 }
    // Use this for initialization
    void Start()
    {
        leaderBoard = new ArrayList();
        leaderBoard.Add("Firebase Top " + MaxScores.ToString() + " Scores");

        FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
            dependencyStatus = task.Result;
            if (dependencyStatus == DependencyStatus.Available)
            {
                InitializeFirebase();
            }
            else
            {
                Debug.LogError(
                    "Could not resolve all Firebase dependencies: " + dependencyStatus);
            }
        });

        ///////////////////////////////


        dataController   = FindObjectOfType <DataController>();
        currentRoundData = dataController.GetCurrentRoundData();
        questionPool     = currentRoundData.questions;
        timeRemaining    = currentRoundData.timeLimitInSeconds;
        UpdateTimeRemainingDisplay();

        playerScore_LD = 0;
        playerScore_RR = 0;
        questionIndex  = 0;

        ShowQuestion();
        isRoundActive = true;
    }
Example #27
0
    private IEnumerator RunRoundStartUp() //Spawn players and prevent them from moving, and handle roundData and round countdown
    {
        roundStartTime = Time.time;
        DestroyAllPlayers();

        SpawnPlayers();
        FreezePlayers();

        if (MatchManager.Instance != null)
        {
            roundData = new RoundData(MatchManager.Instance.m_playersInCup);
        }
        else
        {
            roundData = new RoundData(m_numberOfPlayers);
        }


        m_countdownObject.gameObject.SetActive(true);

        int t = m_roundStartCountdownTime + 1;

        while (t > 0)
        {
            t--;

            m_countdownText.text = t.ToString();
            yield return(new WaitForSeconds(1f));
        }

        m_countdownObject.gameObject.SetActive(false);

        UnFreezePlayers();
    }
Example #28
0
    LoopListViewItem2 InitScrollView(LoopListView2 listView, int index)
    {
        // Debug.Log("InitScrollView index = "+ index);
        if (index < 0 || index >= TotalItemCount)
        {
            return(null);
        }

        RoundData itemData = GetItemDataByIndex(index);

        if (itemData == null)
        {
            return(null);
        }
        //get a new item. Every item can use a different prefab, the parameter of the NewListViewItem is the prefab’name.
        //And all the prefabs should be listed in ItemPrefabList in LoopListView2 Inspector Setting
        LoopListViewItem2 item = listView.NewListViewItem("RoundItem");
        //Debug.Log("item name = "+item.name);
        RoundItem itemScript = item.GetComponent <RoundItem>();

        if (item.IsInitHandlerCalled == false)
        {
            item.IsInitHandlerCalled = true;
            itemScript.Init();
        }
        itemScript.SetItemData(itemData, false, index);
        return(item);
    }
        protected override bool Execute(CodeActivityContext context)
        {
            List <int>     id_List    = ListSectionID.Get(context);
            DateTimeOffset _EventDate = EventDate.Get(context);
            bool           roundData  = RoundData.Get(context);

            if (id_List == null || id_List.Count == 0)
            {
                Error.Set(context, "Список секций не может быть пустым");
                return(false);
            }

            try
            {
                Stream       Res = ARM_Service.XMLExportGetSection80020ForSectionArray(_EventDate, id_List, DataSourceType, BusRelation, roundData, false, TimeZoneId, true, false, false, 1, true).XMLStream;
                MemoryStream ms  = new MemoryStream();
                Res.CopyTo(ms);
                ms.Position = 0;

                Document.Set(context, ms);
            }

            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            return(string.IsNullOrEmpty(Error.Get(context)));
        }
    // Start is called before the first frame update
    void Start()
    {
        //Locate the frontPanel
        panelText = GetComponentsInChildren <Text>();

        //Set the spin count of the panel to zero
        frontSpinCount = 0;
        backSpinCount  = 0;

        //Allow us to access the current round data
        dataController   = FindObjectOfType <DataController>();
        currentRoundData = dataController.GetCurrentRoundData();

        //Load the questions into the questionPool
        questionPool = currentRoundData.questions;

        //Load all the quesiton numbers into our array
        for (int j = 0; j < questionPool.Length; j++)
        {
            unusedQuestions.Add(j);
            //Debug.Log ("Element " + j + " is equal to " + unusedQuestions[j]);
        }
        questionToPanel(0);
        questionToPanel(1);

        //TODO do this by angle of rotation not time
        StartCoroutine(waiterFront(2));
        StartCoroutine(waiterBack(4));
    }
Example #31
0
    public void StartPlayerTwoGame()
    {
        correctImage.SetActive(false);
        incorrectImage.SetActive(false);

        questionDisplay.SetActive(true);

        GameMusic.Play();

        playerScoreOne = playerScore;

        UI.SetActive(true);
        PlayerTwoScreen.SetActive(false);

        dataController = FindObjectOfType <DataController>();

        currentRoundData = dataController.GetCurrentRoundData();
        questionPool     = currentRoundData.questions;
        timeRemaining    = currentRoundData.timeLimitInSeconds;
        UpdateTimeRemainingDisplay();

        playerScore   = 0;
        questionIndex = 0;

        ShowQuestion();
        isRoundActive = true;

        scoredDisplayText.text = "Score: " + playerScore.ToString();
    }
Example #32
0
    /*
     * Deserailize
     * Create level from level data
     * @param LevelData data, deserialized data holder
     */
    public void Deserialize(RoundData data)
    {
        Clear ();

        roundName = data.roundName;
        numPucks = data.numPucks;
        targetSets = new ArrayList ();
        for (int i = 0; i < data.targetSets.Length; i++)
            targetSets.Add (data.targetSets [i]);
    }
        // Updaterar information om runda i tabellena Round & RoundStat genom en lagrad procedur
        public void UpdateRoundData(RoundData roundData)
        {
            using (var conn = CreateConnection())
            {
                try
                {
                    var cmd = new SqlCommand("app.usp_updateRoundData", conn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add("@RoundID", SqlDbType.Int).Value = roundData.RoundID;
                    cmd.Parameters.Add("@Name", SqlDbType.VarChar, 30).Value = roundData.Name;
                    cmd.Parameters.Add("@Date", SqlDbType.Date).Value = roundData.Date;
                    cmd.Parameters.Add("@GIR", SqlDbType.TinyInt).Value = roundData.GIR;
                    cmd.Parameters.Add("@FIR", SqlDbType.TinyInt).Value = roundData.FIR;
                    cmd.Parameters.Add("@Putts", SqlDbType.TinyInt).Value = roundData.Putts;
                    cmd.Parameters.Add("@Penalties", SqlDbType.TinyInt).Value = roundData.Penalties;
                    cmd.Parameters.Add("@Strokes", SqlDbType.TinyInt).Value = roundData.Strokes;

                    conn.Open();

                    cmd.ExecuteNonQuery();
                }
                catch
                {
                    throw new ApplicationException("Ett fel har uppstått vid uppdateringen av rundan i databasen.");
                }
            }
        }
Example #34
0
    void Start()
    {
        GuiControl.lapsToDrive = lapsToDrive;
        _data = new RoundData();

        SetupSound();

        _carScript.ProcessInput = false;
        _infoTextDisplay.text = "";
        _infoTextDisplay.material.color = Color.red;

        _flashTimer = new Clock(timeFlashDuration);

        this._gameState = GameStates.PreStart;
        this._lapNumber = 1;
        this._lapConsumption = new float[lapsToDrive];
        this._lapTimer = new Clock(maxRoundTime);
        this._countdown = new Clock(countdownTime);

        // This class will receive all checkpoint passes in the game
        Checkpoint.MasterCheckReceiver = this;

        this._countdown.Start();

        UpdateGUI();
        PlaySound(GameSounds.BackgroundBirds);
    }
Example #35
0
    /*
     * Serialize
     * Serialize round and organize components into individual arrays
     */
    public RoundData Serialize()
    {
        RoundData data = new RoundData();

        //	Save an array of round names
        data.roundName = roundName;
        data.numPucks = numPucks;

        TargetSet[] sets = new TargetSet[targetSets.Count];
        for (int i = 0; i < targetSets.Count; i++)
            sets [i] = (TargetSet)targetSets [i];
        data.targetSets = sets;

        return data;
    }