void Start()
    {
        mainObj = GameObject.Find("undestructable");
        gm      = mainObj.GetComponent <globalMatchManager> ();
        string     jsonData = File.ReadAllText(@"Assets/jsonSettings.txt");
        jsonConfig json     = JsonUtility.FromJson <jsonConfig>(jsonData);

        sb = new scoreBoardManager();
        string matchText = json.myTeam + " vs " + json.opponentTeam;

        sb.setMatchText(matchText);
        hit = 0;

        if (json.Overs == "2")
        {
            gm.totalBalls = 12;
        }
        else if (json.Overs == "1")
        {
            gm.totalBalls = 6;
        }
        else
        {
            gm.totalBalls = 30;
        }
        gm.init();
        sb.SetTargetText(gm.target.ToString());

        setMaterial(json.myTeam);
        k        = 0;
        userAnim = GameObject.Find("bowler").GetComponent <Animator> ();
        fw       = new feilder_working();
        fs       = new FastBall();
    }
    void Start()
    {
        mainObj = GameObject.Find("undestructable");
        gm      = mainObj.GetComponent <globalMatchManager> ();
        string     jsonData = File.ReadAllText(@"Assets/jsonSettings.txt");
        jsonConfig json     = JsonUtility.FromJson <jsonConfig>(jsonData);


        keeperAnim = GameObject.Find("keeper").GetComponent <Animator> ();
        ballAnim   = GameObject.Find("bowler").GetComponent <Animator> ();
        touch      = 0;
        if (GameObject.Find("Main Camera"))
        {
            fs = GameObject.Find("Main Camera").GetComponent <FastBall> ();
        }
        else
        {
            fs = GameObject.Find("ground").GetComponent <FastBall> ();
        }
        updated = 0;
        mainmenu.gameObject.SetActive(false);
        canvasRendered = 0;
        keepercaught   = 0;
        temp           = 0;
    }
Exemplo n.º 3
0
        public static string GetSymbolicSearch(DTE dte, string searchQuery, jsonConfig jsonConfig)
        {
            //Remove additional information
            int indexOfAdditionalInfo = searchQuery.ToString().IndexOf("Additional information");

            if (indexOfAdditionalInfo > 0)
            {
                searchQuery = searchQuery.Substring(0, indexOfAdditionalInfo);
            }

            StringBuilder sbSearchQuery = new StringBuilder(searchQuery);

            //Remove Application name
            //sbSearchQuery.Replace(dte.Solution.FullName, string.Empty);

            //Remove noise words
            //string wildCard = jsonConfig.replaceNoiseWordsWithAsterisk ? "*" : string.Empty;
            //foreach (string word in jsonConfig.noiseWords) sbSearchQuery.Replace(" " + word + " ", " " + wildCard + " ");
            //sbSearchQuery.Replace(" " + wildCard + " " + wildCard + " ", " " + wildCard + " ");

            foreach (string word in GetProjectNames(dte))
            {
                sbSearchQuery.Replace(word, string.Empty);
            }

            sbSearchQuery.Replace("\n", string.Empty);

            //Inject language(s)
            sbSearchQuery.Insert(0, (string.IsNullOrEmpty(jsonConfig?.codingLanguage) ? GetCodeLanguage(dte) : jsonConfig.codingLanguage));


            return(sbSearchQuery.ToString());
        }
Exemplo n.º 4
0
 private void writeJsonConf(jsonConfig newConfig)
 {
     using (StreamWriter file = File.CreateText(@"settings.json"))
     {
         JsonSerializer serializer = new JsonSerializer();
         serializer.Serialize(file, newConfig);
     }
 }
Exemplo n.º 5
0
 // конфигурирование коннектора к базе
 private jsonConfig readJsonConf()
 {
     using (StreamReader streamOfFile = new StreamReader("settings.json"))
     {
         string     jsonObject = streamOfFile.ReadToEnd();
         jsonConfig config     = JsonConvert.DeserializeObject <jsonConfig>(jsonObject);
         return(config);
     }
 }
Exemplo n.º 6
0
        private void Initialize()
        {
            configuration = readJsonConf();
            string connectionString;

            connectionString = "SERVER=" + configuration.server + ";" + "DATABASE=" +
                               configuration.database + ";" + "UID=" + configuration.uid + ";" + "PASSWORD="******";";
            dbConnect = new MySqlConnection(connectionString);
        }
Exemplo n.º 7
0
 private void Settings_Load(object sender, EventArgs e)
 {
     configuration       = readJsonConf();
     this.serverT.Text   = configuration.server;
     this.databaseT.Text = configuration.database;
     this.uidT.Text      = configuration.uid;
     this.passwordT.Text = configuration.password;
     ForDeeploma.GlobalClass.incrementCounter();
 }
Exemplo n.º 8
0
    public int setTarget(string yourTeam, string oppTeam)
    {
        teams = JsonUtility.FromJson <TeamList>(jsonData);
        json  = JsonUtility.FromJson <jsonConfig>(jsonData1);
        if (json.Overs == "2")
        {
            minScore = 15;
            maxScore = 25;
        }
        else if (json.Overs == "1")
        {
            minScore = 10;
            maxScore = 15;
        }
        int             totTeams = teams.Teams.Count;
        List <TeamInfo> teamsInfo = teams.Teams;
        int             yourTeamRating = 0, oppTeamRating = 0;
        int             minRate = 100000, maxRate = 0;

        for (int i = 0; i < totTeams; i++)
        {
            int teamRating = int.Parse(teamsInfo [i].team_rating);

            if (maxRate < teamRating)
            {
                maxRate = teamRating;
            }

            if (minRate > teamRating)
            {
                minRate = teamRating;
            }

            if (teamsInfo [i].team == yourTeam)
            {
                yourTeamRating = teamRating;
            }
            else if (teamsInfo [i].team == oppTeam)
            {
                oppTeamRating = teamRating;
            }
        }

        int genScore    = computeScoreByRatings(yourTeamRating, oppTeamRating, minRate, maxRate);
        int lowerBound  = genScore - 5;
        int higherBoundBound = genScore + 5;
        int finalTarget = Random.Range(lowerBound, higherBoundBound);

        //populateAutoPlayScore (finalTarget);
        sbm = new scoreBoardManager();
        sbm.SetTargetText(finalTarget.ToString());
        mainObj   = GameObject.Find("undestructable");
        gm        = mainObj.GetComponent <globalMatchManager> ();
        gm.target = finalTarget;
        return(finalTarget);
    }
    void Start()
    {
        mainObj = GameObject.Find("dummyxyz");
        gm      = mainObj.GetComponent <globalMatchManager> ();
        string     jsonData = File.ReadAllText(@"Assets/jsonSettings.txt");
        jsonConfig json     = JsonUtility.FromJson <jsonConfig>(jsonData);

        sb = new scoreBoardManager();
        string matchText = json.myTeam + " vs " + json.opponentTeam;

        sb.setMatchText(matchText);

        k = 0;
    }
        private bool LoadConfiguration()
        {
            string configJSONFile = System.IO.Path.Combine(Application.StartupPath.Replace("\\bin", string.Empty).Replace("\\Debug", string.Empty).Replace("\\Release", string.Empty).Replace("\\x86", string.Empty).Replace("TestClient", "StackoverflowExceptionAssistant"), "Configuration.json");

            if (!File.Exists(configJSONFile))
            {
                MessageBox.Show("The Stackoverflow Exception Assistant Configuration.json file does not exist in the Applications Startup Folder: " + Application.StartupPath + Environment.NewLine + Environment.NewLine + "Stackoverflow Exception Assistant will now quit.", "Cannot find config file...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            try
            {
                string jsonConfigFileContents = FileHelper.ReadFileTextWithEncoding(configJSONFile);
                _jsonConfig = fastJSON.JSON.ToObject <jsonConfig>(jsonConfigFileContents);
            }
            catch (Exception ex)
            {
                MessageBox.Show("The Configuration.json file failed to load, Exception: " + ex.Message + Environment.NewLine + Environment.NewLine + "Stackoverflow Exception Assistant  will now quit.", "Failed to load config file...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Environment.Exit(2);
            }
            return(true);
        }
        private bool SaveConfiguration()
        {
            string configJSONFile = System.IO.Path.Combine(Application.StartupPath.Replace("\\bin\\Debug", "").Replace("TestClient", "StackoverflowExceptionAssistant"), "Configuration.json");

            jsonConfig c = new jsonConfig();

            c.searchEngineWebsite = "015600743573451307836:fzhqm3defkg";
            c.cultureInfo         = "en-US";
            c.opacity             = 60;

            c.resultSort  = ResultsSort.Relevance;
            c.answersSort = AnswersSort.Votes;

            c.topVBUserIds     = "17034,22656,284240,3043,23283,1197518,1968,23354,34397,1359668,1583,65358,366904,1070452,69083,29407,27528,719186,500974,87698,88656,33708,105570,142637,48910,897326,479512,1002323,44597,702199,93623,82187,15639,14149,34211,231316,306651,320,584183,15498,1246391,1348647,2330053,1842065,328193,257954,59111,142822,880990,19307,273200,66532,707111,52249,1163867,1967056,61974,76337,240733,2688,1115360,492405,491243,73070,49241,13302,12950,130611,16076,98713,19299,144424,468973,256431,11683,2480047,84651,8521,1248295,44389,437768,341762,60761,22970,71059,13990,961113,483179,250832,310574,69527,3740093,13279,505088,259769,60188,117870,60682,1081897,1228";
            c.topCsharpUserIds = "22656,23354,88656,17034,29407,34397,65358,23283,1583,284240,69083,33708,263693,1159478,60761,76217,61974,98713,961113,335858,55847,470005,45914,13302,3043,34211,267,413501,572644,329769,93623,84651,50079,1081897,1197518,12950,82187,1968,41071,414076,122718,615,1163867,13627,412770,44389,15861,932418,126014,76337,366904,505088,3010968,993547,13552,447156,1715579,152602,445517,1870803,13087,91671,16076,59303,270591,477420,80274,15541,5380,264697,5445,67,105570,38206,613130,106159,400547,56778,885318,87698,1053,266143,156695,40347,14357,8155,2319407,73070,1228,141172,2530848,60188,1965,103167,63756,24874,38360,314488,11830,15498";
            c.topCppUserIds    = "922184,34509,596781,179910,204847,151292,415784,673730,560648,661519,87234,33213,14065,36565,187690,147192,13005,140719,103167,1968,452307,12711,734069,649665,440558,19563,1932150,85371,1120273,298661,2069064,576911,335858,464581,252000,1774667,5987,129570,1782465,981959,17034,46642,500104,1919155,14860,893,501557,1708801,150634,15416,153285,251738,2756719,505088,2877241,9530,440119,3153,224671,241536,23283,123111,434551,410767,2684539,88656,28169,567292,241631,367273,469935,597607,57428,1413395,65863,168225,365496,496161,721269,1033896,15168,14089,214671,2380830,56338,3647361,82320,1011995,13430,165520,726361,20984,481267,819272,4342498,1498580,1593860,636019,166749,841108";

            c.topBountyHunterIds = "17034, 6309, 157882, 403671, 2558882, 315935, 771848, 1212341, 493939, 29407, 1025118, 115145, 100297, 22656, 1237411, 2083078, 495455, 1906307, 1085891, 1881610, 847363, 517815, 2415822, 149573, 2334192, 5311735, 833622, 4653, 23354, 82788, 5202563, 1184641, 367456, 3155639, 1528401, 1161878, 20860, 983912, 1945960, 1226894, 2646526, 1395668, 872395, 2293534, 1693593, 1045444, 70604, 326480, 857361, 2898867, 291788, 737790, 369707";

            c.excludeProjectName  = true;
            c.excludeSolutionName = true;

            c.codingLanguage = "";

            c.noiseWords = "about,after,all,also,an,and,another,any,are,as,at,be,because,been,before,being,between,both,but,by,came,can,come,could,did,do,each,for,from,get,got,has,had,he,have,her,here,him,himself,his,how,if,in,into,is,it,like,make,many,me,might,more,most,much,must,my,never,now,of,on,only,or,other,our,out,over,said,same,see,should,since,some,still,such,take,than,that,the,their,them,then,there,these,they,this,those,through,to,too,under,up,very,was,way,we,well,were,what,where,which,while,who,with,would,you,your,a".Split(',');
            c.replaceNoiseWordsWithAsterisk = true;

            c.upvoteCopyPastedQuestion = true;
            c.upvoteCopyPastedAnswer   = true;

            string jsonSettings1 = fastJSON.JSON.ToJSON(c);

            File.WriteAllText(configJSONFile, jsonSettings1);

            return(true);
        }
    public void init()
    {
        if (!executedOnce)
        {
            json  = JsonUtility.FromJson <jsonConfig>(jsonData1);
            teams = JsonUtility.FromJson <TeamList>(jsonData);

            yourTeamPlayers     = new List <YourPlayer> (11);
            opponentTeamPlayers = new List <YourPlayer> (11);
            allOvers            = new List <int> (5);
            for (int i = 0; i < 5; i++)
            {
                allOvers.Add(0);
            }

            executedOnce   = true;
            sgen           = new ScoreGenerator();
            target         = sgen.setTarget(json.myTeam, json.opponentTeam);
            autoPlayScores = sgen.populateAutoPlayScore(target);
            int autoPlayBatsmenCount = autoPlayScores.Count;

            yourTeam = json.myTeam;
            oppTeam  = json.opponentTeam;

            TeamInfo teamInfo;
            Players  player = new Players();

            for (int i = 0; i < teams.Teams.Count; i++)
            {
                teamInfo = teams.Teams [i];
                if (teamInfo.team == yourTeam)
                {
                    currentbatsmen = player1Name;
                    for (int iterj = 0; iterj < teamInfo.Players.Count; iterj++)
                    {
                        YourPlayer yourTeamPlayer = new YourPlayer();
                        yourTeamPlayer.playerName = teamInfo.Players [iterj].name;
                        yourTeamPlayer.score      = 0;
                        yourTeamPlayer.balls      = 0;
                        yourTeamPlayer.fours      = 0;
                        yourTeamPlayer.sixes      = 0;
                        yourTeamPlayer.stRate     = 0;
                        yourTeamPlayer.fow        = 0;

                        yourTeamPlayers.Add(yourTeamPlayer);
                    }
                    player1Name    = yourTeamPlayers [0].playerName;
                    player2Name    = yourTeamPlayers [1].playerName;
                    currentbatsmen = player1Name;
                }
                else if (teamInfo.team == oppTeam)
                {
                    for (int iterj = 0; iterj < teamInfo.Players.Count; iterj++)
                    {
                        YourPlayer oppTeamPlayer = new YourPlayer();
                        oppTeamPlayer.playerName = teamInfo.Players [iterj].name;
                        if (iterj < autoPlayBatsmenCount)
                        {
                            oppTeamPlayer.score = autoPlayScores[iterj];
                        }
                        else
                        {
                            oppTeamPlayer.score = 0;
                        }
                        oppTeamPlayer.balls  = 0;
                        oppTeamPlayer.fours  = 0;
                        oppTeamPlayer.sixes  = 0;
                        oppTeamPlayer.stRate = 0;
                        oppTeamPlayer.fow    = 0;
                        opponentTeamPlayers.Add(oppTeamPlayer);
                    }
                }
            }
        }

        updateScoreCanvas();
        updateTriggerCanvas();
    }