Inheritance: MonoBehaviour
Beispiel #1
0
	protected void Init() {
		bf = BattlefieldScript.Instance;
		//bfc = bf.bf;
		su = Submarine.Instance;
		sh = Ship.Instance;
		//la = LanguageScript.Instance;
		mo = move.Instance;
		la = LanguageScript.Instance;
	}
	void Start() {
		Debug.Log ("!!! MULTIPLAYER INITIATED !!!");
		_instance = this;
		bf = BattlefieldScript.Instance;
		bfc = bf.bf;
		su = Submarine.Instance;
		sh = Ship.Instance;
		la = LanguageScript.Instance;
		mo = move.Instance;
		reward = new Reward (false, 5);
	}
    public void Init()
    {
        if (langHolder.childCount == 0)
        {
            CreateLangButtons();
        }
        if (PlayerPrefsManager.GetLang() == string.Empty)
        {
            if (SystemLanguageInList(Application.systemLanguage.ToString()))
            {
                PlayerPrefsManager.SetLang(Application.systemLanguage.ToString());
            }
            else
            {
                PlayerPrefsManager.SetLang(SystemLanguage.English.ToString());
            }
        }
        LanguageScript.ParseStrings();
        if (PlayerPrefsManager.GetLang() == "Hebrew")
        {
            UnityEngine.Object.Destroy(title.GetComponent <ArabicText>());
            UnityEngine.Object.Destroy(button.GetComponent <ArabicText>());
        }
        title.text  = LanguageScript.SelectLanguageText;
        button.text = LanguageScript.PlayTextFixed;
        IEnumerator enumerator = buttonHolder.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                Transform transform = (Transform)enumerator.Current;
                transform.Find("Frame").gameObject.SetActive(value: false);
                transform.Find("Text").GetComponent <Text>().color = Color.white;
                if (transform.name.ToLower() == PlayerPrefsManager.GetLang().ToLower())
                {
                    transform.Find("Frame").gameObject.SetActive(value: true);
                    transform.Find("Text").GetComponent <Text>().color   = FugoUtils.HexToColor("09FF15");
                    transform.Find("Frame").GetComponent <Image>().color = FugoUtils.HexToColor("09FF15");
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         LanguageScript.ParseStrings();
         if (Application.isPlaying)
         {
             UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
         }
     }
     else
     {
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(txtName.Text))
            {
                nameScript = txtName.Text;
                if (radioButton3.IsChecked.Value)
                {
                    languageScript = BioScadaScript.LanguageScript.Visual_Basic;
                }
                else
                {
                    languageScript = BioScadaScript.LanguageScript.C_Sharp;
                }

                txtName.Clear();
                RaiseEvent(new RoutedEventArgs(AddButtonClickEvent));
            }
        }
Beispiel #6
0
 private void SetLanguage()
 {
     _languageScript = FindObjectOfType <LanguageScript>();
     foreach (var language in languages)
     {
         if (language.GetLanguages() == _languageScript.currentLanguage)
         {
             _currentLanguage = language;
         }
     }
     foreach (var language in reminderTranslations)
     {
         if (language.GetLanguages() == _languageScript.currentLanguage)
         {
             _currentMemoLanguage = language;
         }
     }
 }
Beispiel #7
0
    //Defined Start-Routine
    IEnumerator CheckPrestartConditions()
    {
        //Check if all Saved Data is collected
        Debug.Log(LogTime.Time() + ": Game Starter Script - Loading saved Data...");
        SaveDataManager.Load();
        while (!SaveDataManager.firstDataLoaded)
        {
            yield return(new WaitForEndOfFrame());
        }
        Debug.Log(LogTime.Time() + ": Game Starter Script - All saved Data loaded...");

        //Set Language
        Debug.Log(LogTime.Time() + ": Game Starter Script - Going to apply current Language...");
        if (SaveDataManager.getValue.languageManualySet == false)
        {
            var autoLanguage = Application.systemLanguage == SystemLanguage.German ? SettingsLanguages.German : SettingsLanguages.English;
            SaveDataManager.getValue.settingsLanguage = autoLanguage;
            SaveDataManager.Save();
        }
        LanguageScript.UpdateLanguage();
        Debug.Log(LogTime.Time() + ": Game Starter Script - Language Set...");

        //Set Vibration
        VibrationManager.Setup();

        //Setup Google Play
        GoogleLoginScript.instance.CheckAutoSetup();

        //Debug && FreeShop
        if (ConstantManager.freeShop)
        {
            SaveDataManager.getValue.coinItemLVL         = 0;
            SaveDataManager.getValue.secondChanceItemLVL = 0;
            SaveDataManager.getValue.shieldItemLVL       = 0;
            SaveDataManager.getValue.shootItemLVL        = 0;
            SaveDataManager.getValue.shrinkItemLVL       = 0;
            SaveDataManager.getValue.slideItemLVL        = 0;
            SaveDataManager.Save();
        }

        //Call SceneManager to load whatever needs to be loaded
        Debug.Log(LogTime.Time() + ": Game Starter Script - Calling Scene Manager to load first Scene...");
        SceneManager.instance.startGame();
    }
	// Use this for initialization
	void Start () {
		_instance = this;

		if (PlayerPrefs.HasKey ("language")) {
			switch (PlayerPrefs.GetString("language")) {
			case "ukrainian":
				SetUkrainian();
				break;
			case "russian":
				SetRussian();
				break;
			case "english":
				SetEnglish();
				break;
			default:
				break;
			}
		}
		else {
			try {
				Debug.Log("phone language is "+Application.systemLanguage);
				switch (Application.systemLanguage.ToString()) {
				case "Ukrainian":
					SetUkrainian();
					PlayerPrefs.SetString("language", "ukrainian");
					break;
				case "Russian":
					SetRussian();
					PlayerPrefs.SetString("language", "russian");
					break;
				case "English":
					SetEnglish();
					PlayerPrefs.SetString("language", "english");
					break;
				default:
					break;
				}
			} catch (System.Exception) {
				SetEnglish();
				PlayerPrefs.SetString("language", "english");
			}
		}
	}
 private void Awake()
 {
     try
     {
         instance        = this;
         errorText2.text = "Error: 100";
         SetIfArabic();
         errorText2.text = "Error: 101";
         LanguageSelectScript.ParseLangData();
         errorText2.text = "Error: 102";
         if (PlayerPrefsManager.GetHiddenMenu())
         {
             hiddenMenuButton.SetActive(value: true);
         }
         else
         {
             hiddenMenuButton.SetActive(value: false);
         }
         errorText2.text = "Error: 103";
         errorText2.text = "Error: 104";
         errorText2.text = "Error: 105";
         if (GoogleAnalyticsScript.instance == null)
         {
             if (PlayerPrefsManager.GetGARandom() == -1)
             {
                 PlayerPrefsManager.SetGARandom(UnityEngine.Random.Range(0, 10000));
             }
             UnityEngine.Object.Instantiate(googleAnalyticsPrefab).name = "GoogleAnalytics";
         }
         errorText2.text = "Error: 106";
         if (RequestManager.instance == null)
         {
             UnityEngine.Object.Instantiate(reqManager).name = "RequestManager";
             RequestManager.instance.GetLogRequest();
         }
         errorText2.text = "Error: 107";
         errorText2.text = "Error: 108";
         errorText2.text = "Error: 109";
         if (PlayerPrefsManager.GetLang() == string.Empty)
         {
             OpenLanguagePopup(flag: false);
             shouldSetTexts = false;
         }
         else
         {
             LanguageScript.ParseStrings();
             errorText2.text = "Error: 110";
             if (Games.sections == null)
             {
                 Games.ParseGameData(string.Empty);
             }
             errorText2.text = "Error: 111";
             errorText2.text = "Error: 112";
             startButton.transform.localScale  = Vector3.zero;
             questButton.transform.localScale  = Vector3.zero;
             levelsButton.transform.localScale = Vector3.zero;
             dailyButton.transform.localScale  = Vector3.zero;
             errorText2.text = "Error: 113";
             SettingsCloseButtonClicked(0.001f);
             errorText2.text = "Error: 114";
             CloseDailyGiftPopup(0.001f);
             errorText2.text = "Error: 115";
             ShopCloseButtonClicked(0.001f);
             errorText2.text = "Error: 116";
             CloseRewardedPopup(0.001f);
             errorText2.text = "Error: 117";
             CloseHiddenMenu(0.001f);
             errorText2.text = "Error: 118";
             CloseSetTutorialPopup(0.001f);
             CloseQuestPopup(0.001f);
             CloseHiddenLevelPopup(0.001f);
             CloseWheelPopup(0.001f);
             errorText2.text             = "Error: 119";
             QualitySettings.vSyncCount  = 0;
             Application.targetFrameRate = 60;
             errorText2.text             = "Error: 120";
             if (fromGameToSections)
             {
                 sectionPanel.SetActive(value: true);
             }
             errorText2.text = "Error: 121";
             SetVersionText();
             Input.multiTouchEnabled = false;
             errorText2.text         = "Error: 122";
             Screen.sleepTimeout     = -1;
             errorText2.text         = "Error: 123";
             if (SectionController.setCompleted || SectionController.hiddenSetCompleted != -1)
             {
                 sectionPanel.SetActive(value: true);
             }
             errorText2.text = "Error: 124";
             errorText2.text = "Error: 125";
             if (PlayerPrefsManager.IsFirstRun() == 0)
             {
                 PlayerPrefsManager.SetFirstRun();
                 GameController.levelToOpen = -1;
                 StartCoroutine(GoToGameScreenDelayed());
             }
             errorText2.text = "Error: 126";
             if (FugoAdManager.instance == null)
             {
                 UnityEngine.Object.Instantiate(admanagerPrefab).name = "AdManager";
                 errorText.text = "Error: 127";
                 FugoAdManager.instance.coinHolder = animBG;
                 errorText.text = "Error: 128";
                 NotificationSystem.CreateDailyNotification();
                 errorText.text = "Error: 129";
             }
         }
     }
     catch (Exception exception)
     {
         errorText2.gameObject.SetActive(value: true);
         UnityEngine.Debug.LogException(exception);
     }
 }
Beispiel #10
0
        public string CompileScript(ref Dictionary <string, Dictionary <string, object> > Exp_Vars, string Code,
                                    string NameClassScript, LanguageScript Language)
        {
            string returnData = null;

            _NameScript = NameClassScript;

            CodeDomProvider codeProvider = null;

            switch (Language)
            {
            case LanguageScript.C_Sharp:
                codeProvider = new CSharpCodeProvider();
                break;

            case LanguageScript.Visual_Basic:
                codeProvider = new VBCodeProvider();
                break;

            default:
                codeProvider = new CSharpCodeProvider();
                break;
            }

            CodeCompileUnit compileUnit = new CodeCompileUnit();

            CodeNamespace _NameSpace = new CodeNamespace("Tempur");

            // Add the new namespace to the compile unit.
            compileUnit.Namespaces.Add(_NameSpace);

            // Add the new namespace import for the System namespace.
            _NameSpace.Imports.Add(new CodeNamespaceImport("System"));
            _NameSpace.Imports.Add(new CodeNamespaceImport("System.Collections.Generic"));
            _NameSpace.Imports.Add(new CodeNamespaceImport("System.Reflection"));


            CodeTypeDeclaration _ClassTemp = new CodeTypeDeclaration(NameClassScript);

            // Add the new type to the namespace type collection.
            _NameSpace.Types.Add(_ClassTemp);

            foreach (KeyValuePair <string, Dictionary <string, object> > exp in Exp_Vars)
            {
                foreach (KeyValuePair <string, object> variable in exp.Value)
                {
                    CodeMemberField field1 = new CodeMemberField(variable.Value.GetType(), exp.Key + "_" + variable.Key);
                    field1.Attributes = MemberAttributes.Static;
                    CodePrimitiveExpression sd = new CodePrimitiveExpression(variable.Value);
                    field1.InitExpression = sd;
                    _ClassTemp.Members.Add(field1);
                }
            }

            CodeSnippetStatement codeSnippet = new CodeSnippetStatement(Code);
            char comilla = '"';


            CodeMemberMethod Method = new CodeMemberMethod
            {
                Name       = "MethodScript",
                Attributes = MemberAttributes.Public
            };
            CodeParameterDeclarationExpression param = null;

            switch (Language)
            {
            case LanguageScript.C_Sharp:
                param =
                    new CodeParameterDeclarationExpression("System.Collections.Generic.Dictionary<String, Dictionary<String, Object>>",
                                                           "Variables");
                break;

            case LanguageScript.Visual_Basic:
                param =
                    new CodeParameterDeclarationExpression("System.Collections.Generic.Dictionary(Of String, Dictionary(Of String, Object))",
                                                           "Variables");
                break;

            case LanguageScript.C_Plus_Plus:
                param =
                    new CodeParameterDeclarationExpression("System.Collections.Generic.Dictionary<String, Dictionary<String, Object>>",
                                                           "Variables");
                break;

            default:
                param =
                    new CodeParameterDeclarationExpression("System.Collections.Generic.Dictionary<String, Dictionary<String, Object>>",
                                                           "Variables");
                break;
            }

            //param.Direction = FieldDirection.Ref;
            Method.Parameters.Add(param);

            foreach (KeyValuePair <string, Dictionary <string, object> > exp in Exp_Vars)
            {
                string index = "";
                switch (Language)
                {
                case LanguageScript.C_Sharp:
                    index = "Variables[" + comilla + exp.Key + comilla + "]";
                    break;

                case LanguageScript.Visual_Basic:
                    index = "Variables(" + comilla + exp.Key + comilla + ")";
                    break;

                case LanguageScript.C_Plus_Plus:
                    index = "Variables[L" + comilla + exp.Key + comilla + "]";
                    break;

                default:
                    index = "Variables[" + comilla + exp.Key + comilla + "]";
                    break;
                }

                foreach (KeyValuePair <string, object> variable in exp.Value)
                {
                    CodeVariableReferenceExpression field1 = new CodeVariableReferenceExpression(exp.Key + "_" + variable.Key);

                    CodeArgumentReferenceExpression arg = new CodeArgumentReferenceExpression(index);

                    CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression(
                        new CodeTypeReferenceExpression("Convert"), "ChangeType", new CodeExpression[] {
                        new CodeArrayIndexerExpression(arg, new CodePrimitiveExpression(variable.Key)),
                        new CodeTypeOfExpression(new CodeTypeReference(variable.Value.GetType()))
                    });

                    CodeAssignStatement assin = new CodeAssignStatement(field1,
                                                                        new CodeCastExpression(variable.Value.GetType(),
                                                                                               cmie));
                    Method.Statements.Add(assin);
                }
            }

            Method.Statements.Add(codeSnippet);
            foreach (KeyValuePair <string, Dictionary <string, object> > exp in Exp_Vars)
            {
                foreach (KeyValuePair <string, object> variable in exp.Value)
                {
                    string index = "";
                    switch (Language)
                    {
                    case LanguageScript.C_Sharp:
                        index = "Variables[" + comilla + exp.Key + comilla + "]";
                        break;

                    case LanguageScript.Visual_Basic:
                        index = "Variables(" + comilla + exp.Key + comilla + ")";
                        break;

                    case LanguageScript.C_Plus_Plus:
                        index = "Variables[L" + comilla + exp.Key + comilla + "]";
                        break;

                    default:
                        index = "Variables[" + comilla + exp.Key + comilla + "]";
                        break;
                    }
                    CodeVariableReferenceExpression field1 = new CodeVariableReferenceExpression(exp.Key + "_" + variable.Key);
                    CodeArgumentReferenceExpression arg    = new CodeArgumentReferenceExpression(index);
                    CodeAssignStatement             assin  = new CodeAssignStatement(new CodeArrayIndexerExpression(arg,
                                                                                                                    new CodePrimitiveExpression(variable.Key)), field1);
                    Method.Statements.Add(assin);
                }
            }
            _ClassTemp.Members.Add(Method);


            CodeEntryPointMethod start = new CodeEntryPointMethod();

            _ClassTemp.Members.Add(start);

            //IndentedTextWriter tw = new IndentedTextWriter(new StreamWriter("Script//" + NameClassScript, false), "    ");
            //// Generate source code using the code generator.

            //codeProvider.GenerateCodeFromCompileUnit(compileUnit, tw, new CodeGeneratorOptions());
            //// Close the output file.
            //tw.Close();

            //string PathDir = Environment.CurrentDirectory + "\\Script\\" + NameClassScript + ".dll";

            CompilerParameters parameters = new CompilerParameters
            {
                GenerateInMemory = true
            };

            CompilerResults results = codeProvider.CompileAssemblyFromDom(parameters, new CodeCompileUnit[] { compileUnit });

            if (results.Errors.Count > 0)
            {
                var errorMessage = new StringBuilder();
                foreach (CompilerError error in results.Errors)
                {
                    errorMessage.AppendFormat("{0} {1}", error.Line,
                                              error.ErrorText);
                }
                returnData = errorMessage.ToString();
            }
            else
            {
                _Assembly = results.CompiledAssembly;
                classType = _Assembly.GetType("Tempur." + NameClassScript);;

                object o = classType.InvokeMember(null,
                                                  BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic |
                                                  BindingFlags.Instance | BindingFlags.CreateInstance, null, null, null);

                classType.InvokeMember("MethodScript", BindingFlags.DeclaredOnly |
                                       BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod,
                                       null, o, new object[] { Exp_Vars });
            }

            return(returnData);
        }
 public ScriptInAppDomain(string code, string nameScript, LanguageScript language)
 {
     this.code       = code;
     this.nameScript = nameScript;
     this.language   = language;
 }