/**
         * 添加AssetBundle的Item对象
         * */
        private void addABHandler(object target)
        {
            menuParams m     = (menuParams)target;
            AssetsItem asset = new AssetsItem();

            asset.AssetBundleName = m.name;
            asset.VariantName     = 0;
            Parent.list.list.Add(asset);
            Parent.regsList = null;
        }
Example #2
0
    // Use this for initialization
    void Start()
    {
        mP = GameObject.Find("menuParams").GetComponent <menuParams>();

        C = Camera.main.GetComponent <ctrl>();

        if (type == Type.builder)
        {
            GameObject F = new GameObject("MAP");

            //
            hex = Resources.Load <GameObject>("hex");

            bool final = (saveFile == "FINAL");

            if (!final)
            {
                GenHex(F);
            }
            else
            {
                C.Ff.SetActive(true);
            }

            // Set the right demensions
            F.transform.localScale = (Vector3.one * 5) + (Vector3.up * 2);

            //
            if (SceneManager.GetActiveScene().name == "course")
            {
                GameObject stSp = GameObject.Find("StartSphere");
                if (!final)
                {
                    stSp.transform.position    = new Vector3(startPt.x, 0, startPt.z);
                    stSp.transform.eulerAngles = Vector3.up * (startPt.w + ((reverse) ? 180 : 0));
                }
                else
                {
                    stSp.transform.eulerAngles = Vector3.up * (((reverse) ? 180 : 0));
                }

                C.NewDay();
            }
        }
    }
Example #3
0
    //
    void Start()
    {
        // Set the appropriate version number on the top left of screen
        vT.text = "v" + Application.version;

        menuParams.Check4MenuParam();

        // reference to our menu params
        mP = GameObject.Find("menuParams").GetComponent <menuParams>();
        mP.Reset();
        mP.adCount.x++;

        //
        if (Application.isMobilePlatform && mP.adCount.x >= mP.adCount.y)
        {
            //Advertisement.Show();
            mP.adCount.x = 0;
        }

        //
        coursesButts = GameObject.Find("Levels").GetComponentsInChildren <Button>();

        //
        forrestsButts = GameObject.Find("Forrests").GetComponentsInChildren <Button>();

        // Now entirely sure what I have to do this to make Campaign work, too lazy to investigate in depth. >_>
        ToggleListing();
        ToggleListing();

        menuLoad = LoadMenuData();

        sB.value  = Mathf.Round(int.Parse(menuLoad[0]));
        cO.value  = Mathf.Round(int.Parse(menuLoad[1]));
        sel.value = Mathf.Round(int.Parse(menuLoad[2]));
        smT.isOn  = bool.Parse(menuLoad[3]);
        rT.isOn   = bool.Parse(menuLoad[4]);
        rcT.isOn  = bool.Parse(menuLoad[5]);
        lS.value  = int.Parse(menuLoad[6]);
        aS.value  = int.Parse(menuLoad[7]);
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        menuParams.Check4MenuParam();

        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        campAdd = true;

        //
        if (GameObject.Find("menuParams"))
        {
            mP = GameObject.Find("menuParams").GetComponent <menuParams>();

            if (mP.sesh)
            {
                StreamReader sr   = new StreamReader(Path.Combine(Application.dataPath, "sesh.txt"));
                string[]     load = sr.ReadToEnd().Split('\n');
                sr.Close();

                mP.seshMark.y = load.Length;

                if (mP.seshMark.x > mP.seshMark.y)
                {
                    Application.Quit();
                    if (Application.isEditor)
                    {
                        GoToMenu();
                    }
                }

                string[] load2 = load[(int)mP.seshMark.x - 1].Split(',');

                // laps, days, course, CO, Mode, attempts, ini
                mP.laps             = int.Parse(load2[0]);
                mP.maxDays          = int.Parse(load2[1]);
                mP.lvlName          = load2[2];
                mP.lvlData          = menu.ReturnLvlData(load2[2]);
                mP.CO               = (COMode)int.Parse(load2[3]);
                mP.mode             = (GameMode)int.Parse(load2[4]);
                mP.attempts         = int.Parse(load2[5]);
                mP.randomizeWeights = bool.Parse(load2[6]);
                mP.storedName       = load2[7];
            }

            mode                = mP.mode;
            CrossOver           = mP.CO;
            selMode             = mP.SEL;
            randomizeIniWeights = mP.randomizeWeights;
            attempt.y           = mP.attempts;
            mLaps               = mP.laps;
            slowMode            = mP.slowMode;

            //
            if (mode == GameMode.Test)
            {
                attempt.y = mP.brains.Count;
            }
            else if (mode == GameMode.Campaign)
            {
                attempt.y = 1;
            }
            //
            if (mP.brains.Count > 0)
            {
                //
                for (int i = 0; i < mP.brains.Count; i++)
                {
                    loadedBrains.Add(mP.brains[i].Split('\n')[1]);
                }
            }


            //
            lvlBuilder lb = gameObject.AddComponent <lvlBuilder>();

            //
            if (mode == GameMode.Test || mode == GameMode.Train)
            {
                lb.saveFile = mP.lvlData;
                lb.reverse  = mP.reverse;
            }
            else
            {
                mP.lvlName  = "Campaign Course #" + (mP.campaignProgress + 1);
                lb.saveFile = (mP.campaignProgress < 4) ? mP.campaign[(int)Mathf.Floor(mP.campaignProgress)] : "FINAL";
                lb.reverse  = (mP.campaignProgress % 1) != 0;
            }
        }

        //
        graphs[0] = GameObject.Find("FitnessGraph");
        graphs[1] = GameObject.Find("AverageGraph");

        // This will disable the UI if in race mode
        rT[0].gameObject.SetActive(mode == GameMode.Test || mode == GameMode.Campaign);
        rT[1].gameObject.SetActive(mode == GameMode.Train);

        // Set the appropriate version number on the top left of screen
        vT.text = "v" + Application.version;

        // Set all of the input texts to "?" instead of the default "New Text" :)
        for (int i = 0; i < inp.Length; i++)
        {
            inp[i].text = "?";
        }

        // This will hide the starting marker
        startSp.GetComponent <Renderer>().enabled = false;

        // This grabs a ref to the camera's starting position & rotation
        camStarts[0] = Camera.main.transform.position;
        camStarts[1] = Camera.main.transform.eulerAngles;

        // This sets the text for the control & camera mode buttons
        //ctButt.text = intelli.ToString();
        camButt.text = Camy.ToString();

        // attIniData is Attempt Initializer, we first need to define how many brains this ini will hold, it will hold our max attempt count
        attIniData = new float[(int)attempt.y][];

        //
        attIniString = new string[(int)attempt.y];

        // then every brian will hold 29 values, in our case floats, so we'll loop through every brain & set their value size to hold 29 floats, which will be a fully randomized brain
        for (int i = 0; i < attIniData.Length; i++)
        {
            attIniData[i] = new float[29];
        }

        //
        if (loadedBrains == null || loadedBrains.Count < 1)
        {
            //
            if (randomizeIniWeights)
            {
                RandomizeWholeDay();
            }
        }
        else
        {
            SetWholeDay();
        }
    }