Exemple #1
0
        public void SetScenario(int no)
        {
            mScenarioNo = no;

            if (!NameHolder.HasGalaxyName(mName))
            {
                return;
            }

            // Green stars are a little more complicated to determine
            // they don't follow the scenario number scheme that regular stars do
            int greenStarNum = GetGreenStarNo();

            // if there are 3 total green stars, we need to see if we have selected scenarios 1, 2, or 3
            // if there are 2 total green stars, we need to see if we have selected scenarios 1 or 2
            // if we have, we just load the regular scenario names
            // if we have selected a green star, we now have to see what number,
            // by subtracting the number of regular stars to get our current green star index
            if (no < 4 && greenStarNum == 3 || no < 3 && greenStarNum == 2)
            {
                mCurScenarioName = NameHolder.GetScenarioName(mName, no);
            }
            else
            {
                mCurScenarioName = NameHolder.GetScenarioName("GreenStar", greenStarNum == 2 ? no - 2 : no - 3);
            }
        }
Exemple #2
0
    /*
     *  SET BEHAVIOR FOR DIAGNOSTIC MODE HERE
     */
    public virtual void ToggleDiagnosticMode()
    {
        //Debug.Log("Diagnostic toggled");
        GameObject nameObject = GameObject.Find("Name");

        if (nameObject == null)
        {
            Debug.Log("Could not find name object");
            return;
        }
        NameHolder hold = nameObject.GetComponent <NameHolder>();

        if (hold == null)
        {
            Debug.Log("Name object does not have required script");
        }
        if (hold.diagnosticMode)
        {
            hold.SetDiagnosticMode(false);
        }
        else
        {
            hold.SetDiagnosticMode(true);
        }
        Debug.Log("Diagnostic mode set to " + hold.diagnosticMode.ToString());
    }
Exemple #3
0
        public Galaxy(Game game, string name)
        {
            mGame       = game;
            mFilesystem = game.mFilesystem;
            mName       = name;

            mZones = new Dictionary <string, Zone>();
            RARCFilesystem scenarioFile = new RARCFilesystem(mFilesystem.OpenFile($"/StageData/{name}/{name}Scenario.arc"));
            BCSV           scenarioBCSV = new BCSV(scenarioFile.OpenFile("/root/ScenarioData.bcsv"));

            mScenarioEntries = scenarioBCSV.mEntries;
            scenarioBCSV.Close();

            BCSV zonesBCSV = new BCSV(scenarioFile.OpenFile("/root/ZoneList.bcsv"));

            foreach (BCSV.Entry e in zonesBCSV.mEntries)
            {
                string n = e.Get <string>("ZoneName");
                mZones.Add(n, new Zone(this, n));
            }

            zonesBCSV.Close();
            scenarioFile.Close();

            if (!NameHolder.HasGalaxyName(name))
            {
                return;
            }

            mGalaxyName = NameHolder.GetGalaxyName(name);
        }
Exemple #4
0
        public MainWindow()
        {
            InitializeComponent();

            Program.sTranslator = new Translator("English");

            string gamePath = Properties.Settings.Default.GamePath;

            if (gamePath == "")
            {
                MessageBox.Show("Please select a path that contains the dump of your SMG1 / SMG2 copy.");
                bool res = SetGamePath();

                if (!res)
                {
                    return;
                }
            }

            // is it valid AND does it still exist?
            if (gamePath != "" && Directory.Exists(gamePath))
            {
                Setup();
                NameHolder.Initialize();
            }
        }
Exemple #5
0
        public Szerk(MdTermekek termekek)
        {
            rs            = new RktServ();
            this.termekek = termekek;
            InitializeComponent();

            button1.DialogResult = DialogResult.OK;

            NameHolder.setText(termekek.getTNev());

            PriceHolder.setText(termekek.getTar().ToString());

            AmmountHolder.setText(termekek.getTkeszl().ToString());

            UnitHolder.setText(termekek.getMert());

            CodeHolder.setText(termekek.getTkatkod().ToString());


            VonCodeHolder.setText(termekek.getTvonkod().ToString());
            dateTimePicker1.Value = termekek.getSzavido();



            bool eg = false;

            if (termekek.getTegalizalte() == true)
            {
                eg = true;
                checkBox1.CheckState = CheckState.Checked;
            }
        }
Exemple #6
0
    void Start()
    {
        nh = GameObject.Find("Name").GetComponent <NameHolder>();
        resetEveryRound = false;

        // Default size of distribution graph
        if (graphLength == -1)
        {
            graphLength = 1000;
        }

        this.moveFreq = new Dictionary <string, int>()
        {
            { "Foward", 0 },
            { "Back", 0 },
            { "Up", 0 },
            { "Down", 0 },
            { "Button1", 0 },
            { "Button2", 0 },
            { "Button3", 0 },
            { "Button4", 0 }
        };

        this.totalInputs = 0;
    }
    public virtual void SelectPlayerVersusCpu()
    {
        Debug.Log("Player vs CPU");
        NameHolder temp = GameObject.Find("Name").GetComponent <NameHolder>();

        temp.setGameMode("playerVsFuzzy");
        UFE.StartPlayerVersusCpu();
    }
    public virtual void SelectSelfAIvsSelf()
    {
        Debug.Log("Decision vs Decision");
        NameHolder temp = GameObject.Find("Name").GetComponent <NameHolder>();

        temp.setGameMode("decisionVsDecision");
        UFE.StartCpuVersusCpu();
    }
        public static IServiceCollection AddNameHolder(this IServiceCollection services, IConfiguration configuration)
        {
            var nameHolderConfiguration = new NameHolderConfiguration();

            configuration.Bind("NameHolder", nameHolderConfiguration);

            var nameHolder = new NameHolder(nameHolderConfiguration.DefaultName);

            return(services.AddSingleton(nameHolder));
        }
 public void Start()
 {
     if (GameObject.FindGameObjectWithTag("Placeholder"))
     {
         NameHolder nameHolder = GameObject.FindGameObjectWithTag("Placeholder").GetComponent <NameHolder>();
         playerName = nameHolder.getName();
     }
     else
     {
         playerName = "Chosen One";
     }
 }
Exemple #11
0
    private void SaveName()
    {
        GameObject obj = new GameObject("NameHolder");

        DontDestroyOnLoad(obj);

        NameHolder name = obj.AddComponent <NameHolder>();

        name.name = nameText.text;

        if (name.name == "")
        {
            name.name = "Blank Being";
        }
    }
Exemple #12
0
    /* Utilities
     */
    // At the end of each round
    void OnRoundEnds(CharacterInfo winner, CharacterInfo loser)
    {
        // Save the winner
        //Debug.Log(Constants.WhichPlayer(winner, p1) + " wins");
        bb.UpdateProperty(Constants.WhichPlayer(winner, p1), Constants.winner, "true");

        // Diagnostic reset
        GameObject nameObj = GameObject.Find("Name");

        if (nameObj != null)
        {
            NameHolder name = nameObj.GetComponent <NameHolder>();
            if (name != null)
            {
                name.setRoundStarted(false);
            }
        }
    }
Exemple #13
0
    static void Main(string[] args)
    {
        //string MyName = "Hello";
        NameHolder MyName = new NameHolder();

        MyName.Name = "hello";
        Console.WriteLine($"Main thinks Main's name is: {MyName.Name}");
        Console.WriteLine($"");
        Console.WriteLine($"Creating ClassA");
        ClassA classA = new ClassA(MyName);

        Console.WriteLine($"Main thinks Main's name is: {MyName.Name}");
        classA.WriteOutMainName();
        MyName.Name = "GoodBye";
        Console.WriteLine($"");
        Console.WriteLine($"Main changed it's name to: {MyName.Name}");
        Console.WriteLine($"");
        Console.WriteLine($"Main thinks Main's name is: {MyName.Name}");
        classA.WriteOutMainName();
    }
Exemple #14
0
    public override void Initialize(IEnumerable <InputReferences> inputs, int bufferSize)
    {
        this.timeLastDecision = float.NegativeInfinity;
        base.Initialize(inputs, bufferSize);
        //bb = GameObject.FindObjectOfType<BlackBoard>();
        bb = GameObject.Find("BlackBoard").GetComponent <BlackBoard>();
        //dta = GameObject.FindObjectOfType<DecisionTreeAI>();
        dta = GameObject.Find("BlackBoard").GetComponent <DecisionTreeAI>();
        //dta.LoadJSON("./C45algorithm-master/KOSH.json");
        dta.LoadJSON("./C45algorithm-master/shahan.json");

        c = GameObject.FindObjectOfType <Canvas>();

        nameObj = GameObject.Find("Name");
        if (nameObj != null)
        {
            nameScript = nameObj.GetComponent <NameHolder>();
        }

        waiting     = false;
        waitingMove = "";
    }
    public override void OnShow()
    {
        base.OnShow();
        this.visible = true;

        if (this.music != null)
        {
            UFE.DelayLocalAction(delegate(){ UFE.PlayMusic(this.music); }, this.delayBeforePlayingMusic);
        }

        if (this.stopPreviousSoundEffectsOnLoad)
        {
            UFE.StopSounds();
        }

        if (this.onLoadSound != null)
        {
            UFE.DelayLocalAction(delegate(){ UFE.PlaySound(this.onLoadSound); }, this.delayBeforePlayingMusic);
        }

        if (this.musicToggle != null)
        {
            this.musicToggle.isOn = UFE.config.music;
        }

        if (this.musicSlider != null)
        {
            this.musicSlider.value = UFE.config.musicVolume;
        }

        if (this.soundToggle != null)
        {
            this.soundToggle.isOn = UFE.config.soundfx;
        }

        if (this.soundSlider != null)
        {
            this.soundSlider.value = UFE.config.soundfxVolume;
        }

        int difficultySettingsLength    = UFE.config.aiOptions.difficultySettings.Length;
        AIDifficultySettings difficulty = UFE.GetAIDifficulty();

        if (this.difficultySlider != null)
        {
            this.difficultySlider.minValue     = 0;
            this.difficultySlider.maxValue     = difficultySettingsLength - 1;
            this.difficultySlider.wholeNumbers = true;
            this.difficultySlider.value        = this.GetDifficultyIndex(difficulty);
        }

        if (this.difficultyName != null)
        {
            this.difficultyName.text = difficulty.difficultyLevel.ToString();
        }

        if (this.aiEngineName != null)
        {
            AIEngine aiEngine = UFE.GetAIEngine();

            if (aiEngine == AIEngine.RandomAI)
            {
                this.aiEngineName.text = "Random";
            }
            else
            {
                this.aiEngineName.text = "Fuzzy";
            }
        }

        if (this.debugModeToggle != null)
        {
            this.debugModeToggle.isOn = UFE.config.debugOptions.debugMode;
        }

        if (this.diagnosticModeToggle != null)
        {
            GameObject nameObj = GameObject.Find("Name");
            if (nameObj != null)
            {
                NameHolder name = nameObj.GetComponent <NameHolder>();
                if (name != null)
                {
                    this.diagnosticModeToggle.isOn = name.diagnosticMode;
                }
                else
                {
                    Debug.Log("Could not find nameholder script");
                }
            }
            else
            {
                Debug.Log("Could not find name object");
            }
        }
        if (this.changeControlsButton != null)
        {
            this.changeControlsButton.gameObject.SetActive(
                UFE.isCInputInstalled && UFE.config.inputOptions.inputManagerType == InputManagerType.cInput
                );
        }

        this.HighlightOption(this.FindFirstSelectable());
    }
Exemple #16
0
        public HelloController(NameHolder nameHolder, IActionContextAccessor accessor)
        {
            _nameHolder = nameHolder;

            _accessor = accessor;
        }
Exemple #17
0
 public ClassA(NameHolder mainName)
 {
     MainName = mainName;
 }
    public virtual void SaveSkillTree()
    {
        //Debug.Log("Attempting to save");
        GameObject[] temp      = GameObject.FindGameObjectsWithTag("Node");
        NodeControl  reference = null;

        if (temp == null)
        {
            Debug.Log("Could not find nodes");
            return;
        }
        else
        {
            foreach (GameObject node in temp)
            {
                NodeControl tempNC = node.GetComponent <NodeControl>();
                //Debug.Log("Ability Name: " + tempNC.abilityName);
                //Debug.Log("Parent: " + tempNC.parent);
                if (tempNC.parent > -1 && tempNC.connections[tempNC.parent].abilityName == "Root")
                {
                    reference = tempNC;
                    break;
                }
            }
        }

        if (reference == null)
        {
            Debug.Log("Could not get NodeControl");
        }

        if (reference == null)
        {
            Debug.Log("Could not output");
            return;
        }
        //else Debug.Log("Found Node");

        BlackBoardController bbc = GameObject.Find("Skills").GetComponent <BlackBoardController>();

        if (!bbc.SaveSkills())
        {
            Debug.Log("Could not save skills");
        }
        else
        {
            //Debug.Log("Save success");
        }

        Debug.Log(bbc.savedSkillList.Count + " Skill(s) Saved");
        string output = "";
        int    i      = 0;

        foreach (string s in bbc.savedSkillList)
        {
            if (bbc.savedSkillList.Count < (i + 1))
            {
                output += (s + " ");
            }
            else
            {
                output += (s + ", ");
            }
        }
        //Debug.Log(output);
        //Debug.Log(reference.ToString());

        bbc.DisplaySavedSkills(output);
        NameHolder store = GameObject.Find("Name").GetComponent <NameHolder>();

        Debug.Log(store.username + " has a skilltree = " + reference.ToString());
        StartCoroutine(PostDataToServer.PostSkillTree(store.username, reference.ToString()));
        //SkillTreeStructure newTree = new SkillTreeStructure().FromJSON("{\"name\" : \"Aggression\",\"left\" : {\"name\" : \"Power\",\"left\" : \"\",\"right\" : \"\",\"down\" : {\"name\" : \"Safety\",\"left\" : \"\",\"right\" : \"\",\"down\" : \"\"}},\"right\" : \"\",\"down\" : \"\"}");
        store.skillTree = new SkillTreeStructure().FromJSON(reference.ToString());
    }
    /* Constructing a skill tree
     */
    // Rebuild a skill tree given the file that it's stored in
    public void GetTree(CharacterInfo playerInfo, bool isP1)
    {
        if (isP1)
        {
            p1               = playerInfo;
            players[0]       = p1;
            playerObjects[0] = GameObject.Find(Constants.p1Key);

            /*
             * // Grab raw text
             * string path = Constants.SKILL_TREE_DIR + p1Filename.Replace(".json", "");
             * string content = Resources.Load<TextAsset>(path).text;
             *
             * // Parse as JSON
             * var skillTree = JSON.Parse(content);
             */
            // Build the tree by converting the JSON to the summary struct

            // Default tree for demonstration purposes only
            //p1Root = new SkillTreeStructure("Ghost", RootSkill(), new SkillTreeStructure(), new SkillTreeStructure(), new SkillTreeStructure());
            //p1Root.Attach(new SkillTreeStructure("Surprise"), (int)Constants.Branch.DOWN);
            //p1Root.connections[(int)Constants.Branch.DOWN].Attach(new SkillTreeStructure("Applause"), (int)Constants.Branch.LEFT);
            NameHolder store = GameObject.Find("Name").GetComponent <NameHolder>();
            if (store.ExistsTree())
            {
                p1Root = store.skillTree;
            }
            else
            {
                p1Root = Constants.BuildDefaultTree();
            }
        }
        else
        {
            p2               = playerInfo;
            players[1]       = p2;
            playerObjects[1] = GameObject.Find(Constants.p2Key);

            /*
             * // Grab raw text
             * string path = Constants.SKILL_TREE_DIR + p2Filename.Replace(".json", "");
             * string content = Resources.Load<TextAsset>(path).text;
             *
             * // Parse as JSON
             * var skillTree = JSON.Parse(content);
             */
            // Build the tree by converting the JSON to the summary struct

            // Default tree for demonstration purposes only
            //p2Root = new SkillTreeStructure("Ghost", RootSkill(), new SkillTreeStructure(), new SkillTreeStructure(), new SkillTreeStructure());
            //p2Root.Attach(new SkillTreeStructure("Surprise"), (int)Constants.Branch.DOWN);
            //p2Root.connections[(int)Constants.Branch.DOWN].Attach(new SkillTreeStructure("Applause"), (int)Constants.Branch.LEFT);
            NameHolder store = GameObject.Find("Name").GetComponent <NameHolder>();
            if (store.ExistsTree())
            {
                p2Root = store.skillTree;
            }
            else
            {
                p2Root = Constants.BuildDefaultTree();
            }
        }
    }
Exemple #20
0
    // Happens every round
    public void OnRoundBegins(int roundNumber)
    {
        // Reset the BlackBoard to clear out information from the previous round
        bb.ClearBlackBoard();

        // Reset Distribution if enabled
        distr.ResetCount();

        // Set diagnostics on battle screen
        GameObject nameObj = GameObject.Find("Name");

        if (nameObj != null)
        {
            NameHolder name = nameObj.GetComponent <NameHolder>();
            if (name != null)
            {
                name.setRoundStarted(true);
            }
        }

        // Add information about each player to Blackboard
        bb.Register(Constants.p1Key, new Dictionary <string, string>()
        {
            // Who am I?
            { Constants.playerName, "" },

            // Passives
            { Constants.indexLifePoints, p1.currentLifePoints.ToString() },
            { Constants.indexFavor, Constants.MIN_FAVOR.ToString() },
            { Constants.indexRally, Constants.MIN_RALLY.ToString() },
            { Constants.indexBalance, Constants.STARTING_BALANCE.ToString() },

            // Extra data for conditioning on moves
            { Constants.lastHitDamage, "0" },
            { Constants.lastAttackByPlayer, "" },
            { Constants.landedLastAttack, "" },
            { Constants.lastEvade, "" },
            { Constants.lastEvadeSuccessful, "" },
            { Constants.lastAttackByOpponent, "" },
            { Constants.opponentLandedLastAttack, "" },

            // Extra data for skill tree nodes

            // Surprise
            { Surprise.attackCount, "0" },
            { Surprise.evadeCount, "0" },

            // Distance to opponent
            { Constants.distToOpponent, Vector3.Distance(UFE.GetPlayer1Controller().transform.position, UFE.GetPlayer2Controller().transform.position).ToString() },

            // Match results
            { Constants.winner, "false" }
        });
        bb.Register(Constants.p2Key, new Dictionary <string, string>()
        {
            // Who am I?
            { Constants.playerName, "" },

            // Passives
            { Constants.indexLifePoints, p2.currentLifePoints.ToString() },
            { Constants.indexFavor, Constants.MIN_FAVOR.ToString() },
            { Constants.indexRally, Constants.MIN_RALLY.ToString() },
            { Constants.indexBalance, Constants.STARTING_BALANCE.ToString() },

            // Extra data for conditioning on moves
            { Constants.lastHitDamage, "0" },
            { Constants.lastAttackByPlayer, "" },
            { Constants.landedLastAttack, "" },
            { Constants.lastEvade, "" },
            { Constants.lastEvadeSuccessful, "" },
            { Constants.lastAttackByOpponent, "" },
            { Constants.opponentLandedLastAttack, "" },

            // Extra data for skill tree nodes

            // Surprise
            { Surprise.attackCount, "0" },
            { Surprise.evadeCount, "0" },

            // Distance to opponent
            { Constants.distToOpponent, Vector3.Distance(UFE.GetPlayer1Controller().transform.position, UFE.GetPlayer2Controller().transform.position).ToString() },

            // Match results
            { Constants.winner, "false" }
        });

        // Save BlackBoard state
        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            bb.UpdateProperty(Constants.p1Key, Constants.playerName, GameObject.Find("Name").GetComponent <NameHolder>().username);
            bb.DumpBlackBoard(Constants.p2Key);
        }
        else
        {
            if (UFE.GetLocalPlayer() == 1)
            {
                bb.UpdateProperty(Constants.p1Key, Constants.playerName, GameObject.Find("Name").GetComponent <NameHolder>().username);
            }
            else
            {
                bb.UpdateProperty(Constants.p2Key, Constants.playerName, GameObject.Find("Name").GetComponent <NameHolder>().username);
            }
        }
    }