Inheritance: MonoBehaviour
Beispiel #1
0
        private void Awake()
        {
            if (!UserPrefs.SessionActive())
            {
                _btnCancel.GetComponent <TextMeshProUGUI>().SetText("Done");
                _btnContinue.gameObject.SetActive(false);
            }

            SceneManager.activeSceneChanged += RemoveEvents;

            _values = new List <float>();

            GameObject        _coreGameBehaviourGameObject = new GameObject("CoreGameBehvaiour");
            CoreGameBehaviour _coreGameBehaviourScript     = _coreGameBehaviourGameObject.AddComponent <CoreGameBehaviour>();

            // Programmatically add button click events
            _btnContinue.onClick.AddListener(_coreGameBehaviourScript.LoadNextScene);

            _scoreData = FindObjectOfType <ScoreDataHolder>();

            // Know which scene script will ONLY live
            _scoreData.ParentScene = SceneManager.GetActiveScene().name;

            _scoreText.SetText($"{_scoreData.MinScore}/{_scoreData.MaxScore}");

            _graphContainer = transform.Find("GraphContainer").GetComponent <RectTransform>();

            ShowGraph(_scoreData.category, _scoreData.MinScore, _scoreData.MaxScore);
        }
Beispiel #2
0
 private void btnCreateUser_Click(object sender, RoutedEventArgs e)
 {
     //TODO error check input
     try
     {
         string userName = this.userNameBox.Text;
         string password = this.passwordBox.Password;
         string confirm  = this.cpasswordBox.Password;
         string name     = this.nameBox.Text;
         bool   isAdmin  = (bool)this.isAdminCheck.IsChecked;
         if (userName != "" && password != "" && password == confirm && name != "")
         {
             new UserSyncer().WebCreateUser(userName, password, name, isAdmin);
             User user = new User(userName, password, name, isAdmin);
             UserPrefs.AddUser(user);
             this.Close();
         }
         else
         {
             MessageBox.Show("Cannot create user with empty fields");
         }
     } catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Beispiel #3
0
        public IActionResult Browse()
        {
            if (tempUsername != null)
            {
                User      currentUser      = context.Users.Single(c => c.Username == tempUsername);
                UserPrefs currentUserPrefs = context.Preferences.Single(p => p.ID == currentUser.UserPrefsID);

                string price     = currentUserPrefs.UsersPrice;
                string area      = currentUserPrefs.UsersArea;
                string careLevel = currentUserPrefs.UsersCareLevel;

                List <Community> communityMatches = new List <Community>();

                List <Community> communities = context.Communities.ToList();

                foreach (Community com in communities)
                {
                    if (com.Price == price && com.Area == area && com.CareLevel == careLevel)
                    {
                        communityMatches.Add(com);
                    }
                }

                ViewBag.number = 1;
                return(View(communityMatches));
            }

            List <Community> allCommunities = context.Communities.ToList();

            return(View(allCommunities));
        }
 static void LoadPlayerPreferences(GameManager manager)
 {
     m_nameFormat       = UserPrefs.GetNameFormat();
     m_healthManaFormat = UserPrefs.GetHealthManaFormat();
     manager.UpdatePlayerNameFormat();
     manager.UpdatePlayerHealthManaFormat();
 }
 public void LoginToServer()
 {
     if (!popUpMessage.activeSelf)
     {
         string username = usernameField.text, password = passwordField.text;
         if (!TryGetIpPort(out string ip, out int port))
         {
             ConnectionIssue("Invalid IP or Port.");
             return;
         }
         UserPrefs.SetUsername(username);
         UserPrefs.SetServerIp(ip);
         UserPrefs.SetServerPort(port);
         UserPrefs.Save();
         ConnectToServer(ip, port, username, password);
         InteractableObjectsEnabled(false);
         popUpMessage.SetActive(true);
         if (pendingCoroutine != null)
         {
             StopCoroutine(pendingCoroutine);
         }
         pendingCoroutine = UpdatePendingMessage();
         StartCoroutine(pendingCoroutine);
     }
 }
Beispiel #6
0
 public MainWindow(UserPrefs userPrefs)
 {
     UserPrefs = userPrefs;
     InitializeComponent();
     _graphics1 = new GraphicalApp(this.ListView1, this.PathOfListView1);
     _graphics2 = new GraphicalApp(this.ListView2, this.PathOfListView2);
 }
Beispiel #7
0
 void SkipLevel()
 {
     if (UserPrefs.totalCoins >= Constants.COINSTOSKIPLEVEL)
     {
         UserPrefs.totalCoins -= Constants.COINSTOSKIPLEVEL;
         if (UserPrefs.currentLevel + 1 > Constants.levelsPerEpisode)
         {
             if (UserPrefs.currentEpisode < UserPrefs.unlockLevelsArrays.Length && !UserPrefs.episodeUnlockArray[UserPrefs.currentEpisode])
             {
                 //	Instantiate(Resources.Load("SubMenus/EpisodeUnlockMenu"));
                 GameManager.Instance.ChangeState(GameManager.SoundState.BUTTONCLICKSOUND, GameManager.GameState.EPISODEUNLOCK);
                 UserPrefs.episodeUnlockArray[UserPrefs.currentEpisode] = true;
                 UserPrefs.Save();
             }
             else
             {
                 GameManager.Instance.ChangeState(GameManager.GameState.EPISODEMENU);
                 Application.LoadLevel("MenusScene");
             }
         }
         else
         {
             NextLevel();
         }
     }
     else
     {
         //Destroy(GameObject.FindGameObjectWithTag("LevelSkip"));
         //Instantiate(Resources.Load("SubMenus/LevelOutofCandies"));
         GameManager.GameState previous = GameManager.Instance.GetPreviousGameState();
         GameManager.Instance.ChangeState(GameManager.SoundState.BUTTONCLICKSOUND, GameManager.GameState.STORE);
         GameManager.Instance.SetPreviousGameState(previous);
     }
     UserPrefs.Save();
 }
Beispiel #8
0
 void Awake()
 {
     gameManager  = GetComponent <GameManager>();
     soundManager = GetComponent <SoundManager>();
     userPrefs    = GetComponent <UserPrefs>();
     DontDestroyOnLoad(gameObject);
 }
 private void clearBtn_Click(object sender, RoutedEventArgs e)
 {
     UserPrefs.Instance.devicePrefs.Remove(UserPrefs.Instance.defaultProperty);
     UserPrefs.Instance.defaultProfile = null;
     UserPrefs.SavePrefs();
     Close();
 }
Beispiel #10
0
        public void CheckInput(TMP_InputField input)
        {
            DatabaseManager databaseManager = new DatabaseManager();
            var             user            = databaseManager.GetUser(input.text);

            databaseManager.Close();

            if (user == null)
            {
                Debug.Log("<color=red>Not found!</color>");

                TextMeshProUGUI notifText = (TextMeshProUGUI)_uiManager.GetUI(UIManager.UIType.Text, "login notif");
                notifText.transform.gameObject.SetActive(true);
                notifText.SetText("User not found");
                notifText.color = new Color32(255, 0, 0, 189);
                return;
            }

            Debug.Log("<color=green>Exists!</color>");

            UserPrefs.UpdateUserPrefs(user.Username, "start menu", true);

            FindObjectOfType <StatsManager>().UpdateRadarChart();

            TransitionFrom((Transform)_uiManager.GetUI(UIManager.UIType.Panel, "login"));
            TransitionTo((Transform)_uiManager.GetUI(UIManager.UIType.Panel, "start menu"));

            // Prevent stacking of the login page after successful login
            _pageStack.Remove((Transform)_uiManager.GetUI(UIManager.UIType.Panel, "login"));
        }
Beispiel #11
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            User tempUser = new UserSyncer().WebLogin(Username.Text, Password.Password);

            if (tempUser != null)
            {
                UserPrefs.SetUser(tempUser, true);
                this.AddPasswordHash(Username.Text, PasswordHash.Hash(Password.Password));
                MainWindow mainWindow = ((MainWindow)Application.Current.MainWindow);
                this.Close();
            }
            else
            {
                if (this.CheckPasswordLocal(Username.Text, Password.Password))
                {
                    UserPrefs.SetUser(new Users.User(Username.Text, Password.Password, Username.Text), false);

                    MainWindow mainWindow = ((MainWindow)Application.Current.MainWindow);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Wrong username or password");
                }
            }
        }
Beispiel #12
0
    // Use this for initialization
    void Start()
    {
//		UnityAdsHelper.Initialize ();
        UserPrefs.Load();

        if (!UserPrefs.firstTimeGameLaunch)
        {
            UserPrefs.Save();
        }



//		GAManager.Instance.LogDesignEvent("GameLaunch:Splash");

        if (!UserPrefs.isSound)
        {
            SoundManager.Instance.MuteSound();
        }


        if (!UserPrefs.isMusic)
        {
            SoundManager.Instance.MuteMusic();
        }
    }
Beispiel #13
0
#pragma warning restore IDE1006

        public override void PopulateEntry(PwEntry pwEntry, PwDatabase pwDatabase, UserPrefs userPrefs, RecordType recordType)
        {
            base.PopulateEntry(pwEntry, pwDatabase, userPrefs, recordType);

            if (this.URLs != null)
            {
                int i = 1;

                string mainURLString = null;

                if (pwEntry.Strings.Exists(PwDefs.UrlField))
                {
                    mainURLString = pwEntry.Strings.Get(PwDefs.UrlField).ReadString();
                }

                foreach (URL url in this.URLs)
                {
                    if (url.url.Equals(mainURLString))
                    {
                        continue;
                    }

                    string urlLabel = url.label;

                    if (string.IsNullOrEmpty(url.label))
                    {
                        urlLabel = string.Format("URL {0}", i++);
                    }

                    pwEntry.Strings.Set(urlLabel, new ProtectedString(pwDatabase.MemoryProtection.ProtectUrl, url.url));
                }
            }
        }
Beispiel #14
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("escaped clicked.intialize ");

        if (this.gameObject.name.Equals("btnHome"))
        {
            if (UserPrefs.unlockLevelsArrays[UserPrefs.currentEpisode - 1] == UserPrefs.currentLevel)
            {
                UserPrefs.unlockLevelsArrays[UserPrefs.currentEpisode - 1]++;
            }

            UserPrefs.Save();
            SubMenusOld.Instance.EnableBackground();
            if (UserPrefs.currentLevel + 1 > Constants.levelsPerEpisode)
            {
                //	UserPrefs.unlockLevelsArrays[UserPrefs.currentEpisode-1] = Constants.levelsPerEpisode;
                GameObject.Find("btnNext").SetActive(false);
                //GameObject home = GameObject.Find("btnHome");
                this.transform.localPosition = new Vector3(-95f, this.transform.localPosition.y, this.transform.localPosition.z);
                GameObject skip = GameObject.Find("btnRetry");
                Debug.Log("---------------skip called. ");
                skip.transform.localPosition = new Vector3(110, skip.transform.localPosition.y, skip.transform.localPosition.z);
            }
        }
    }
        public IActionResult ChangePrefs(PreferencesViewModel preferencesViewModel)
        {
            if (ModelState.IsValid)
            {
                if (tempUsername != null)
                {
                    User currentUser = context.Users.Single(c => c.Username == tempUsername);

                    UserPrefs currentUserPrefs = context.Preferences.Single(p => p.ID == currentUser.UserPrefsID);

                    currentUserPrefs.UsersPrice     = preferencesViewModel.UsersPrice;
                    currentUserPrefs.UsersArea      = preferencesViewModel.UsersArea;
                    currentUserPrefs.UsersCareLevel = preferencesViewModel.UsersCareLevel;

                    context.Preferences.Update(currentUserPrefs);
                    context.SaveChanges();

                    return(Redirect("/HomePage/Browse"));
                }

                //TODO - return an error letting the user know that he needs to login or register first
                string prefsError = "Please login or register to change preferences.";
                ViewBag.error = prefsError;
                ViewBag.n     = 3;
                return(View(preferencesViewModel));
            }
            return(View(preferencesViewModel));
        }
Beispiel #16
0
        /// <summary>
        /// loads existing local password hashes from the system!
        /// </summary>
        private void LoadPasswordHashes()
        {
            this.userPasswordHashes = new Dictionary <string, string>();

            string fileName = UserPrefs.GetPasswordHashDirectory() + @"\hashes.txt";

            if (!File.Exists(fileName))
            {
                return;
            }

            string line;

            using (StreamReader reader = new StreamReader(fileName))
            {
                while ((line = reader.ReadLine()) != null)
                {
                    try
                    {
                        string[] args = line.Split(' ');
                        this.AddPasswordHash(args[0], args[1]);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
        }
 public void AddCoins(int coins)
 {
     Debug.LogError("coins being added" + coins);
     UserPrefs.totalCoins     += coins;
     UserPrefs.coinsCollected += coins;
     UserPrefs.Save();
 }
    void hideButtons()
    {
        int starting_num = 0;

        if (Constants.selectedLevel == 0)
        {
            starting_num = 0;
        }
        else if (Constants.selectedLevel == 1)
        {
            starting_num = 2;
        }
        else if (Constants.selectedLevel > 1)
        {
            UserPrefs.isTutorialFinished = true;
            UserPrefs.Save();
            Destroy(gameObject);
        }


        for (int i = starting_num; i < Button.Length; i++)
        {
            Button[i].GetComponent <CanvasGroup>().alpha          = 0;
            Button[i].GetComponent <CanvasGroup>().interactable   = false;
            Button[i].GetComponent <CanvasGroup>().blocksRaycasts = false;

            if (Button[i].GetComponent <Animator>())
            {
                Button[i].GetComponent <Animator>().enabled = false;
            }
        }

        Number = starting_num;
    }
Beispiel #19
0
#pragma warning restore IDE1006

        public virtual void PopulateEntry(PwEntry pwEntry, PwDatabase pwDatabase, UserPrefs userPrefs)
        {
            if (!string.IsNullOrEmpty(this.title))
            {
                pwEntry.Strings.Set(PwDefs.TitleField, new ProtectedString(pwDatabase.MemoryProtection.ProtectTitle, this.title));
            }
        }
Beispiel #20
0
    public void purchaseFuel(int price, int fuel)
    {
        if (UserPrefs.totalCoins > price)
        {
            UserPrefs.isOutOfFuel = true;
            GAManager.Instance.LogDesignEvent("CoinCons:LevelTimeUp:Boost:tb" + price + ":Lvl#" + UserPrefs.currentLevel);

            //	UserPrefs.totalCoins -= price;
            GameManager.Instance.SubtractCoins(price);
            GameManager.Instance.AddTime(fuel);
            GameManager.Instance.ShowTime(price);
            UserPrefs.Save();
            Destroy(GameObject.FindGameObjectWithTag("LevelOutOfFuel"));
            //	Destroy(GameObject.FindGameObjectWithTag("Hud"));
            //	Resources.UnloadUnusedAssets();
            Resources.UnloadUnusedAssets();
            GameManager.Instance.ChangeState(GameManager.SoundState.BUTTONCLICKSOUND, GameManager.GameState.GAMEPLAY);
            //	StartCoroutine(MenuManager.Instance.LoadScene(0));
        }
        else
        {
            //	Instantiate(Resources.Load("SubMenus/LevelOutofCandies"));
            GameManager.Instance.ChangeState(GameManager.SoundState.BUTTONCLICKSOUND, GameManager.GameState.STORE);
        }
    }
Beispiel #21
0
        private void Save(string path, bool xml)
        {
            try
            {
                listMaker1.AlphaSortList();
                int noA = listMaker1.Count;

                int roundlimit = Convert.ToInt32(numSplitAmount.Value / 2);

                if ((noA % numSplitAmount.Value) <= roundlimit)
                {
                    noA += roundlimit;
                }

                int noGroups =
                    Convert.ToInt32((Math.Round(noA / numSplitAmount.Value) * numSplitAmount.Value) / numSplitAmount.Value);

                if (xml)
                {
                    for (int i = 0; i < noGroups; i++)
                    {
                        List <Article> listart = new List <Article>();
                        for (int j = 0; j < numSplitAmount.Value && listMaker1.Count != 0; j++)
                        {
                            listart.Add(listMaker1.SelectedArticle());
                            listMaker1.Remove(listMaker1.SelectedArticle());
                        }

                        _p.List.ArticleList = listart;

                        UserPrefs.SavePrefs(_p, path.Replace(".xml", " " + (i + 1) + ".xml"));
                    }
                    MessageBox.Show("Lists Saved to AWB Settings Files");
                }
                else
                {
                    for (int i = 0; i < noGroups; i++)
                    {
                        StringBuilder strList = new StringBuilder();

                        for (int j = 0; j < numSplitAmount.Value && listMaker1.Count != 0; j++)
                        {
                            strList.AppendLine(listMaker1.SelectedArticle().ToString());
                            listMaker1.Remove(listMaker1.SelectedArticle());
                        }
                        Tools.WriteTextFileAbsolutePath(strList.ToString(), path.Replace(".txt", " " + (i + 1) + ".txt"),
                                                        false);
                    }
                    MessageBox.Show("Lists saved to text files");
                }
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message, "Save error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }
    public void SetVeichleControls(int control)
    {
        btnControl1.GetComponentInChildren <UISprite>().spriteName = "selected-point2";
        btnControl2.GetComponentInChildren <UISprite>().spriteName = "selected-point2";
        btnControl3.GetComponentInChildren <UISprite>().spriteName = "selected-point2";

        if (control == 0)             // steering wheel
        {
            UserPrefs.accelerometerFactor = 0;
            btnControl2.GetComponentInChildren <UISprite>().spriteName = "selected-point";
            GAManager.Instance.LogDesignEvent("Settings:Wheel");
            //	GameObject.FindWithTag("Steering").renderer.enabled = true;
            //	GameObject.FindGameObjectWithTag("LeftTurnSteering").renderer.enabled = false;
            //	GameObject.FindGameObjectWithTag("RightTurnSteering").renderer.enabled = false;
        }
        else if (control == 1)           // accelarometer / tilt
        {
            UserPrefs.accelerometerFactor = 1;
            btnControl3.GetComponentInChildren <UISprite>().spriteName = "selected-point";
            GAManager.Instance.LogDesignEvent("Settings:Tilt");
            //	GameObject.FindWithTag("Steering").renderer.enabled = false;
            //      GameObject.FindGameObjectWithTag("LeftTurnSteering").renderer.enabled = false;
            //      GameObject.FindGameObjectWithTag("RightTurnSteering").renderer.enabled = false;
        }
        else if (control == 2)             // right left buttons
        {
            UserPrefs.accelerometerFactor = 2;
            btnControl1.GetComponentInChildren <UISprite>().spriteName = "selected-point";
            GAManager.Instance.LogDesignEvent("Settings:Buttons");
            //	GameObject.FindWithTag("Steering").renderer.enabled = false;
            //      GameObject.FindGameObjectWithTag("LeftTurnSteering").renderer.enabled = true;
            //      GameObject.FindGameObjectWithTag("RightTurnSteering").renderer.enabled = true;
        }
        UserPrefs.Save();
    }
Beispiel #23
0
 public void SaveCreateTime()
 {
     if (!UserPrefs.HasKey(UserCreateTimeKey))
     {
         UserPrefs.SetDateTime(UserCreateTimeKey, DateTime.Now);
     }
 }
Beispiel #24
0
        /// <summary>
        /// Load preferences from file
        /// </summary>
        private void LoadPrefs(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            try
            {
                LoadPrefs(UserPrefs.LoadPrefs(path));

                SettingsFile    = path;
                StatusLabelText = "Settings successfully loaded";
                UpdateRecentList(path);
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleException(ex);
            }

            SettingsFile = path;

            if (removeDuplicatesToolStripMenuItem.Checked)
            {
                listMaker.RemoveListDuplicates();
            }
        }
Beispiel #25
0
 public iPhoneList()
 {
     /// TODO: Add ability to Edit and Delete Links
     InitializeComponent();
     SetObjectSizes();
     SetStatus();
     toolsMain.Location     = new Point(0, 0);
     toolsFileView.Location = new Point(203, 0);
     //ToolStripManager.Renderer = new Office2007Renderer();
     //myPhone.Connect += new ConnectEventHandler(Connecting);
     //myPhone.Disconnect += new ConnectEventHandler(Connecting);
     prefs         = new UserPrefs();
     links         = new LinkNodes();
     ipItems       = new ItemProperties();
     ipItems.Phone = myPhone;
     try {
         LoadUserPreferences();
         LoadConfig();
     }
     catch (Exception err) {
         Console.WriteLine(err.Message);
     }
     ipItems.Phone = myPhone;
     splitFilesViewer.Panel2Collapsed = true;
     if (prefs.Preview.TabSpaces == 0)
     {
         prefs.Preview.TabSpaces = 4;
     }
     previewTextBox.Tag = "empty";
     timerMain.Enabled  = true;
 }
Beispiel #26
0
        private void Start()
        {
            Debug.Log("Pause panel init");

            _coreGameBehaviour = Resources.FindObjectsOfTypeAll <CoreGameBehaviour>();
            if (_coreGameBehaviour == null)
            {
                return;
            }

            if (UserPrefs.SessionActive())
            {
                transform.Find("ButtonTryAgain").GetComponent <Button>().interactable = false;
            }

            // Auto attaches resume capability for all game types
            foreach (var item in _coreGameBehaviour.Where(i => !i.name.Equals(transform.name)))
            {
                transform.Find("ButtonResume").GetComponent <Button>().onClick.AddListener(item.Pause);
                transform.Find("ButtonTryAgain").GetComponent <Button>().onClick.AddListener(item.Retry);
            }

            OnMuteGameEvent  += UpdateUI;
            OnPauseGameEvent += ShowDialog;

            SceneManager.activeSceneChanged += RemoveEvents;

            AudioManager.OnAllAudioOverrideEvent += AudioOverride;
        }
Beispiel #27
0
#pragma warning restore IDE1006

        public override void PopulateEntry(PwEntry pwEntry, PwDatabase pwDatabase, UserPrefs userPrefs, RecordType recordType)
        {
            base.PopulateEntry(pwEntry, pwDatabase, userPrefs, recordType);

            if (fields != null)
            {
                foreach (WebFormField webFormField in fields)
                {
                    string value = webFormField.value ?? string.Empty;

                    if (webFormField.designation == FieldDesignation.username)
                    {
                        pwEntry.Strings.Set(PwDefs.UserNameField, new ProtectedString(pwDatabase.MemoryProtection.ProtectUserName, value));
                    }
                    else if (webFormField.designation == FieldDesignation.password)
                    {
                        pwEntry.Strings.Set(PwDefs.PasswordField, new ProtectedString(pwDatabase.MemoryProtection.ProtectPassword, value));
                    }
                    else if (webFormField.type != WebFormFieldType.B && webFormField.type != WebFormFieldType.I) // Buttons and Submit elements are not relevant to the form
                    {
                        pwEntry.Strings.Set(string.Format("WebForm - {0}", webFormField.name), new ProtectedString((webFormField.type == Types.WebFormFieldType.P && pwDatabase.MemoryProtection.ProtectPassword) || (webFormField.type == Types.WebFormFieldType.U && pwDatabase.MemoryProtection.ProtectUrl), value));
                    }
                }
            }
        }
Beispiel #28
0
        /// <summary>
        /// Save preferences to file
        /// </summary>
        private void SavePrefs(string path)
        {
            try
            {
                UserPrefs.SavePrefs(MakePrefs(), path);

                UpdateRecentList(path);
                SettingsFile = path;

                //Delete temporary/old file if exists when code reaches here
                if (File.Exists(SettingsFile + ".old"))
                {
                    File.Delete(SettingsFile + ".old");
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);

                // don't attempt to write to disk if the error was IOException (disk full etc.)
                if (!(ex is IOException) && File.Exists(SettingsFile + ".old"))
                {
                    File.Copy(SettingsFile + ".old", SettingsFile, true);
                }
            }
        }
    void Start()
    {
        UserPrefs.Load();
        if (UserPrefs.isTutorialFinished || GameManager.Instance.currentGameMode == GameManager.GameMode.SurvivalMode)
        {
            Destroy(gameObject);
        }
        else if (!UserPrefs.isTutorialFinished)
        {
            if (Constants.selectedLevel == 0 || Constants.selectedLevel == 1)
            {
                hideButtons();
            }
            else
            {
                Destroy(gameObject);
            }

            if (Constants.selectedLevel == 0)
            {
                _currentTutorialState = TutorialState.JoyStick;
                showText();
            }
            else if (Constants.selectedLevel == 1)
            {
                _currentTutorialState = TutorialState.DefendButton;
                showText();
            }
        }


        Debug.Log("tutorial status : " + UserPrefs.isTutorialFinished);
    }
Beispiel #30
0
 void NextLevel()
 {
     //	UserPrefs.unlockLevelsArrays[UserPrefs.currentEpisode-1]++;
     //	UserPrefs.Save();
     if (UserPrefs.currentLevel + 1 > Constants.levelsPerEpisode)           // 12 >= 12
     {
         if (UserPrefs.currentEpisode < UserPrefs.unlockLevelsArrays.Length)
         {
             //Instantiate(Resources.Load("SubMenus/EpisodeUnlockMenu"));
             GameManager.Instance.ChangeState(GameManager.SoundState.BUTTONCLICKSOUND, GameManager.GameState.EPISODEUNLOCK);
             UserPrefs.episodeUnlockArray[UserPrefs.currentEpisode] = true;
             UserPrefs.Save();
         }
         else
         {
             GameManager.Instance.ChangeState(GameManager.SoundState.BUTTONCLICKSOUND, GameManager.GameState.MAINMENU);
             Application.LoadLevel(Constants.SCENE_MENU);
         }
     }
     else
     {
         UserPrefs.currentLevel++;
         GameManager.Instance.ChangeState(GameManager.SoundState.BUTTONCLICKSOUND, GameManager.GameState.VEHICLESELECTIONMENU);
         Application.LoadLevel(Constants.SCENE_MENU);
     }
 }
Beispiel #31
0
        public HttpGadgetContext(HttpContext context)
        {
            this.request = context.Request;
            this.context = context;

            container = getContainer(request);
            debug = getDebug(request);
            ignoreCache = getIgnoreCache(request);
            locale = getLocale(request);
            moduleId = getModuleId(request);
            renderingContext = getRenderingContext(request);
            url = getUrl(request);
            userPrefs = getUserPrefs(request);
            view = getView(request);
        }
Beispiel #32
0
 public static void addSubstitutions(Substitutions substituter,
                                     GadgetSpec spec, UserPrefs values)
 {
     foreach (UserPref pref in spec.getUserPrefs())
     {
         String name = pref.getName();
         String value = values.getPref(name);
         if (value == null)
         {
             value = pref.getDefaultValue();
             if (value == null)
             {
                 value = "";
             }
         }
         substituter.addSubstitution(Substitutions.Type.USER_PREF, name, HttpUtility.HtmlEncode(value));
     }
 }
Beispiel #33
0
        /**
        * @param context Request global parameters.
        * @param gadget Values for the gadget being rendered.
        * @throws JSONException If parameters can't be extracted or aren't correctly formed.
        */
        public JsonRpcGadgetContext(JsonObject context, JsonObject gadget)
        {
            this.context = context;
            this.gadget = gadget;

            url = getUrl(gadget);
            moduleId = getModuleId(gadget);
            userPrefs = getUserPrefs(gadget);
            locale = getLocale(context);
            view = context["view"] as string;
            bool ic;
            bool.TryParse(context["ignoreCache"] as string, out ic);
            ignoreCache = ic;
            container = context["container"] as string;
            bool d;
            bool.TryParse(context["debug"] as string, out d);
            debug = d;
            renderingContext = RenderingContext.METADATA;
        }
Beispiel #34
0
 public void AddToUserPrefs(UserPrefs userPrefs)
 {
     base.AddObject("UserPrefs", userPrefs);
 }
Beispiel #35
0
 public static UserPrefs CreateUserPrefs(int ID, string mailAddress, string password, string server, string port, string sSL, global::System.DateTime createdDate, string disaplayName, string rePassword, byte[] rowVersion)
 {
     UserPrefs userPrefs = new UserPrefs();
     userPrefs.Id = ID;
     userPrefs.MailAddress = mailAddress;
     userPrefs.Password = password;
     userPrefs.Server = server;
     userPrefs.Port = port;
     userPrefs.SSL = sSL;
     userPrefs.CreatedDate = createdDate;
     userPrefs.DisaplayName = disaplayName;
     userPrefs.rePassword = rePassword;
     userPrefs.RowVersion = rowVersion;
     return userPrefs;
 }
Beispiel #36
0
        /* 2. Search - Per Page - Page List */
        private string SearchAndPageHTML()
        {
            filtertheSearch();

            StringBuilder sb = new StringBuilder();
            this.perPage = PageRequest.Form["perpage"];
            UserPrefs up = new UserPrefs(Utils.User.UserName);
            string prefPerPage = up.getPreference(this.GridTable.TableName);
            if (string.IsNullOrEmpty(this.perPage))
            {
                this.perPage = string.IsNullOrEmpty(prefPerPage) ? "50" : prefPerPage;
            }
            if (! prefPerPage.Equals(this.perPage))
            {
                up.SetPreference(this.GridTable.TableName, this.perPage);
            }

            string[] aryPerPage = new string[] { "10", "20", "30", "40", "50", "70", "100" };

            sb.Append("<thead><tr><td colspan=\"" + (GridTable.TableFields.Count + 1).ToString() + "\">");
            sb.Append("<table class=\"gridpaging\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td>Per Page</td><td>");
            sb.Append("<input type=\"hidden\" id=\"sortby\" name=\"sortby\"  value=\"" + HttpUtility.HtmlEncode(this.HeaderSortBy) + "\" /><input type=\"hidden\" id=\"sortdir\" name=\"sortdir\" value=\"" + HttpUtility.HtmlEncode(this.HeaderSortDir) + "\"/>");
            sb.Append("<select id=\"perpage\" name=\"perpage\" onchange=\"submit();\">");
            for (int i = 0; i < aryPerPage.Length; i++)
            {
                sb.Append("<option value=\"" + HttpUtility.HtmlEncode(aryPerPage[i]) + "\" " + (this.perPage.Equals(aryPerPage[i]) ? "selected" : "") + " >" + HttpUtility.HtmlEncode(aryPerPage[i]) + "</option>");
            }
            sb.Append("</select></td><td style=\"border-right:1px solid #333;\">&nbsp;</td>");
            sb.Append("<td>Search</td><td><select style=\"padding:2px;font-family:Tahoma;font-size:10px;\"  id=\"searchField\" name=\"searchField\" ><option value=\"\"></option>");
            string searchField = PageRequest.Form["searchField"];

            for(int j=0; j< GridTable.TableFields.Count; j++)
            {
                string fldname = GridTable.TableFields[j].fieldName.ToLower();
                if (!(fldname.Equals("guidfield") || fldname.Equals("lastchange") || fldname.Equals("lastchangeuser")))
                {
                    sb.Append("<option value=\"" + HttpUtility.HtmlEncode(fldname) + "\" " + ((!string.IsNullOrEmpty(searchField) && searchField.Equals(fldname, StringComparison.InvariantCultureIgnoreCase))? " selected " : "")  + ">" + HttpUtility.HtmlEncode( GridTable.TableFields[j].fieldHeader) + "</option>");
                }
            }
            string searchVal = PageRequest.Form["searchValue"];
            if (string.IsNullOrEmpty(searchVal)) searchVal = "";
            sb.Append("</select></td><td><input type=\"text\" style=\"padding:2px;font-family:Tahoma;font-size:10px;\" id=\"searchValue\" name=\"searchValue\" size=\"12\" maxlength=\"20\" value=\"" + HttpUtility.HtmlEncode(searchVal) + "\" /></td><td><a  href=\"javascript:void(0);\" onclick=\"submit();\"><img src=\"images\\zoom.png\" style=\"height:16px;width:16px;vertical-align:middle;border:0px;\" alt=\"search\" /></a></td>");

            /* Pages HTML */
            int perpage;
            int.TryParse(this.perPage, out perpage);
            this.startRec = 0;
            this.endRec = this.TotalRec;
            if (this.TotalRec > perpage)
            {
                sb.Append("<td style=\"border-right:1px solid #333;\">&nbsp;</td>");
                int numPages = (this.TotalRec / perpage) + 1;
                string cpage = PageRequest.Form["curpage"];
                int curpage;
                int.TryParse(cpage, out curpage);
                if (curpage > 1)
                {
                    sb.Append("<td><img src=\"images\\pagestart.png\" alt=\"start\" title=\"start page\" onclick=\"gotoPage(0);\" /></td>");
                    sb.Append("<td><img src=\"images\\pageprior.png\" alt=\"prior\" title=\"prior page\" onclick=\"gotoPage(-1);\" /></td>");
                }
                sb.Append("<td><select id=\"curpage\" name=\"curpage\" onchange=\"submit();\">");
                for (int pn = 1; pn <= numPages; pn++)
                {
                    sb.Append("<option value=\"" + pn.ToString() + "\" " + ((curpage==pn)?"selected":"")  + " >" + pn.ToString() + "</option>");
                }
                sb.Append("</select></td>");
                if (curpage != numPages)
                {
                    sb.Append("<td><img src=\"images\\pagenext.png\" alt=\"next\" title=\"next page\" onclick=\"gotoPage(1);\" /></td>");
                    sb.Append("<td><img src=\"images\\pageend.png\" alt=\"end\" title=\"end page\" onclick=\"gotoPage(" + numPages.ToString() + ");\" /></td>");
                }
                this.startRec = (curpage!=0) ? (curpage-1) * perpage : 0;
                this.endRec = this.startRec + perpage;
                if (this.endRec > this.TotalRec) this.endRec = this.TotalRec;
            }
            sb.Append("</tr></table>");
            sb.Append("</td></tr></thead>");
            return sb.ToString();
        }