예제 #1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            // INIT STUFF
            #region Init variables
            {
                this.Text         = String.Format("BustersMC Updater APP v {0}-{1} ({2})", VERSION, BUILD, DATE);
                lVersionThis.Text = BUILD.ToString();

                logThis(String.Format("Launched in \"{0}\".", pathApp));

                // Create folder structure
                try {
                    if (!Directory.Exists(pathAppTemp))
                    {
                        Directory.CreateDirectory(pathAppTemp);
                    }
                    if (!Directory.Exists(pathAppRepository))
                    {
                        Directory.CreateDirectory(pathAppRepository);
                    }
                }
                catch { }

                // DEFINE HTTP CONNECTION ROOT, must be here for the updater to catch up!
                if (Properties.Settings.Default.HTTP_DocumentRoot != "")
                {
                    Connection.HTTP.DocumentRoot = Properties.Settings.Default.HTTP_DocumentRoot;
                    eConnectionHTTPUri.Text      = Properties.Settings.Default.HTTP_DocumentRoot;
                    eConnectionHTTPUri.ForeColor = Color.LawnGreen;
                }
                else
                {
                    Connection.HTTP.DocumentRoot = eConnectionHTTPUri.Text;
                }

                UPDATER_WEB_ROOT = forwardSlashPath(Connection.HTTP.DocumentRoot + UPDATER_PATH);
            }
            #endregion

            // Run without IFs, to just get the version.
            if (upToDate() == false)
            {
                tsbAppUpdate.Enabled = true;
            }

            // FETCH THE MISSING FILES
            #region Fetch application files
            {
                if (!File.Exists(backSlashPath(pathApp) + "changelog.txt"))
                {
                    DownloadFile(UPDATER_WEB_ROOT + "changelog.txt", backSlashPath(pathApp) + "changelog.txt");
                }
                // temporarily force the updating of blacklist file
                //if ( !File.Exists( backSlashPath( pathApp ) + "blacklist" ) ) {
                DownloadFile(UPDATER_WEB_ROOT + "blacklist", backSlashPath(pathApp) + "blacklist");
                //}
            }
            #endregion

            // READ THE BLACKLIST FROM FILE
            #region Read the Blacklist and Changelog
            StreamReader f;
            try {
                f = File.OpenText(backSlashPath(pathApp) + "blacklist");
                while (!f.EndOfStream)
                {
                    fileBlacklist.Add(f.ReadLine());
                }
                f.Close();
                tbBlacklist.Text      = String.Join("\r\n", fileBlacklist);
                tbBlacklist.ForeColor = Color.FromArgb(216, 216, 216);
            }
            catch (FileNotFoundException exception) {
                // File not Found. Create and close (the file).
                logThis("File 'blacklist' is not found. Attempting to create.");
                FileStream f2 = File.Create(backSlashPath(pathApp) + "blacklist");
                f2.Close();
            }
            // Read the Changelog
            try {
                f = File.OpenText(backSlashPath(pathApp) + "changelog.txt");
                tbChangelog.Text = f.ReadToEnd();
                f.Close();
            }
            catch { }
            #endregion

            /*
             * Load selection related settings from registry
             * */
            #region Load selection choice from registry
            {
                /**
                 * LOAD VARIABLES FROM REGISTRY
                 **/
                // If we have saved path for MultiMC Path...
                if (Properties.Settings.Default.MultiMCPath != "")
                {
                    setMultiMCPath(Properties.Settings.Default.MultiMCPath);
                }
                // And for Repository
                if (Properties.Settings.Default.RepositoryPath != "")
                {
                    setRepoPath(Properties.Settings.Default.RepositoryPath);
                }
                else
                {
                    setRepoPath(pathAppRepository);
                }

                // Load default HTTP Document Root
                if (Properties.Settings.Default.HTTP_DocumentRoot != "")
                {
                    Connection.HTTP.DocumentRoot = Properties.Settings.Default.HTTP_DocumentRoot;
                }

                // Selected instance...
                if (Properties.Settings.Default.SelectedInstance != "")
                {
                    selectInstance(Properties.Settings.Default.SelectedInstance);
                }
                // ... and selected branch
                if (Properties.Settings.Default.SelectedBranch != "")
                {
                    refreshModpackList();
                    logThis(String.Format("THIS IS DEBUG YADDA YADDA, {0}", Properties.Settings.Default.SelectedBranch));
                    selectRemoteBranch(Properties.Settings.Default.SelectedBranch);
                    cbModpacks.Text = Properties.Settings.Default.SelectedBranch;
                }
            }
            #endregion


            refreshModpackList();
        }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (helpTimer < 10.0f)
        {
            helpTimer -= Time.deltaTime;
            if (helpTimer <= 0.0f)
            {
                Debug.Log("disabling Help");
                helpImg.SetActive(false);
                helpTimer = 10.0f;
            }
        }

        if (kissTimer != 5.0f)
        {
            kissTimer -= Time.deltaTime;
            if (kissTimer <= 0.0f)
            {
                Kiss.GetComponent <ParticleEmitter>().emit = false;
                kissTimer = 5.0f;
            }
        }

        Ray  ray;
        bool hand2d = false;

        if (PreferredHand == HAND_SIDES.Right)
        {
            hand2d = GetComponentInChildren <HandRenderer> ().queryRightHand2DCoordinates(out cursor2d);
            if (!hand2d)
            {
                hand2d = GetComponentInChildren <HandRenderer> ().queryLeftHand2DCoordinates(out cursor2d);
            }
        }
        else
        {
            hand2d = GetComponentInChildren <HandRenderer> ().queryLeftHand2DCoordinates(out cursor2d);
            if (!hand2d)
            {
                hand2d = GetComponentInChildren <HandRenderer> ().queryRightHand2DCoordinates(out cursor2d);
            }
        }

        if (!hand2d)
        {
            //		cursor.SetActive (false);
            cursor2d          = Input.mousePosition;
            ray               = camera.ScreenPointToRay(Input.mousePosition);
            Screen.lockCursor = false;
            Screen.showCursor = true;
        }
        else
        {
            //		cursor.SetActive (true);
            //		cursor.GetComponent<RectTransform> ().position = cursor2d;
            ray = camera.ScreenPointToRay(cursor2d);
            Screen.lockCursor = true;
            Screen.showCursor = false;
        }

        RaycastHit hit;
        int        terrainlayermask = 1 << 9;

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, terrainlayermask))
        {
            //sphere.transform.position = new Vector3 (hit.point.x, hit.point.y + 1.0f, hit.point.z);
            cursor3d = hit.point;
        }

//		Instantiate (object, mousePo, Quaternion.identity);

        switch (mode)
        {
        case MODE.DEFAULT:
            if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2))
            {
                Cursor.SetCursor(closed, Vector2.zero, CursorMode.Auto);
            }
            else if (Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1) || Input.GetMouseButtonUp(2))
            {
                Cursor.SetCursor(normal, Vector2.zero, CursorMode.Auto);
            }
            break;

        case MODE.BUILD:
            if (Input.GetMouseButtonDown(0))
            // create object and place at mouse posisition
            {
            }
            Debug.Log(build.ToString());
            if (Input.GetMouseButtonUp(0) && build != BUILD.NONE)
            {
                Debug.Log("Build done");
                // Place the object;
            }

            break;

        case MODE.THUNDER_CLAP:
            Cursor.SetCursor(thunderclap_cursor, Vector2.zero, CursorMode.Auto);
            if (!isOnHUD() && !isOnShelf())
            {
                if (Input.GetMouseButtonUp(0))
                {
                    // Trigger Thunder Clap
//					PeopleManager.GetComponent<LoadVoxelPeople>().Powermode = LoadVoxelPeople.MODE.THUNDER_CLAP;
//					PeopleManager.GetComponent<LoadVoxelPeople>().pointOfContact = cursor3d;
                    PowerThunderClap.Trigger(cursor3d);
                    setMode(MODE.DEFAULT);
                }
            }
            break;

        case MODE.WINDY:
            break;

        case MODE.GMBC:
            break;

        case MODE.MJOLNIR:
            Cursor.SetCursor(mjolnir_cursor, Vector2.zero, CursorMode.Auto);
            if (!isOnHUD() && !isOnShelf())
            {
                if (Input.GetMouseButtonUp(0))
                {
                    // Trigger Mjolnir at cursor3d

                    /*
                     * PeopleManager.GetComponent<LoadVoxelPeople>().Powermode = LoadVoxelPeople.MODE.MJOLNIR;
                     * PeopleManager.GetComponent<LoadVoxelPeople>().pointOfContact = cursor3d;
                     * if(currentLevel != null){
                     *      currentLevel.GetComponent<ZombieManager>().Powermode = ZombieManager.MODE.MJOLNIR;
                     *      currentLevel.GetComponent<ZombieManager>().hit3DLoc = cursor3d;
                     * } */

                    PowerMjolnir.Trigger(cursor3d);
                    setMode(MODE.DEFAULT);
                }
            }
            break;

        case MODE.FIREBALL:
            Cursor.SetCursor(fireball_cursor, Vector2.zero, CursorMode.Auto);
            if (!isOnHUD() && !isOnShelf())
            {
                if (Input.GetMouseButtonUp(0))
                {
                    // Trigger Fireball at cursor3d
//					PeopleManager.GetComponent<LoadVoxelPeople>().Powermode = LoadVoxelPeople.MODE.FIREBALL;
//					PeopleManager.GetComponent<LoadVoxelPeople>().pointOfContact = cursor3d;
//					if(currentLevel != null){
//						currentLevel.GetComponent<ZombieManager>().Powermode = ZombieManager.MODE.FIREBALL;
//						currentLevel.GetComponent<ZombieManager>().hit3DLoc = cursor3d;
//					}
                    PowerFireball.Trigger(cursor3d);
                    setMode(MODE.DEFAULT);
                }
            }
            break;

        case MODE.TORNADO:
            Cursor.SetCursor(tornado_cursor, Vector2.zero, CursorMode.Auto);
            if (!isOnHUD() && !isOnShelf())
            {
                if (Input.GetMouseButtonUp(0))
                {
                    // Trigger Tornado at cursor3d
//					PeopleManager.GetComponent<LoadVoxelPeople>().Powermode = LoadVoxelPeople.MODE.TORNADO;
//					PeopleManager.GetComponent<LoadVoxelPeople>().pointOfContact = cursor3d;
//					if(currentLevel != null){
//						currentLevel.GetComponent<ZombieManager>().Powermode = ZombieManager.MODE.TORNADO;
//						currentLevel.GetComponent<ZombieManager>().hit3DLoc = cursor3d;
//					}
                    PowerTornado.Trigger(cursor3d);
                    setMode(MODE.DEFAULT);
                }
            }
            break;

        case MODE.BOO:
            PowerBoo.Trigger(cursor3d);
            setMode(MODE.DEFAULT);
            break;

        case MODE.HEY:
            PowerHey.Trigger(cursor3d);
            setMode(MODE.DEFAULT);
            break;

        case MODE.HOG:
            Cursor.SetCursor(tornado_cursor, Vector2.zero, CursorMode.Auto);
            if (!isOnHUD() && !isOnShelf())
            {
                if (Input.GetMouseButtonUp(0))
                {
                    PowerHoG.Trigger(cursor3d);
                    setMode(MODE.DEFAULT);
                }
            }
            break;
        }
    }