Ejemplo n.º 1
0
 private void Awake()
 {
     _inputField.contentType = InputField.ContentType.IntegerNumber;
     _inputField.onEndEdit.AddListener(OnEndEdit);
     _onValueChanged = new IntEvent();
 }
    private void Start()
    {
        DefenderSpawner defenderSpawner = FindObjectOfType <DefenderSpawner>();

        onStarGeneration = defenderSpawner.getStarGenerationEvent();
    }
Ejemplo n.º 3
0
    // Use this for initialization
    private void Start()
    {
        // Initialise variables
        GameOptions.LoadOptions();
        challengeGenerator = GetComponent <ChallengeGenerator>();
        challengeGenerator.GenerateChallenges();
        audioManager = GetComponent <AudioManager>();
        menu         = FindObjectOfType <Menu>();

        dictData = new DictData(dict);
        dictData.Setup();
        letterList = new DictData(challengesFile);
        letterList.CleanLetterCombos();
        letters = new char[3];
        scores  = new Scores();
        answers = new List <string>();
        word    = new Word();
        input.onEndEdit.AddListener(CheckInput);
        gameState      = GameState.Pregame;
        IncreasePoints = new IntEvent();
        IncreaseTime   = new IntEvent();

        bannedWords = bannedWordsAsset.ToString().Split('\n').ToList();
        for (int i = 0; i < bannedWords.Count(); ++i)
        {
            bannedWords[i] = bannedWords[i].TrimEnd('\r');
        }

        // Check if this is the first time the game has been played
        bool playedBefore = false;

        for (int mode = 1; mode < 3; ++mode)
        {
            // For each game mode
            for (int diff = 1; diff < 4; ++diff)
            {
                // For each difficulty
                if (scores.GetBestScore((GameMode)mode, (Difficulty)diff) > 0)
                {
                    // If high score > 0 then played before
                    playedBefore = true;
                    break;
                }
            }

            if (playedBefore)
            {
                break;
            }
        }

        // Finished initialising variables

        // If not played before then start with the tutorial
        if (!playedBefore)
        {
            FindObjectOfType <LogoOpening>().SetNotPlayedBefore();
            GameInfo.SetGameMode(GameMode.Welcome);
        }

#if UNITY_IOS || UNITY_ANDROID
        // Initialise ads on mobile
        Ads.AdFinished.AddListener(AdCompleted);
        Ads.AdSkipped.AddListener(AdCompleted);
        Ads.AdFailed.AddListener(GoToMenu);
#endif
    }
Ejemplo n.º 4
0
 /// <summary>
 /// UEvent数据写入无返回值字典
 /// </summary>
 /// <param name="int">UEvent</param>
 /// <param name="key">键</param>
 public void PutUEventInVoidDic(IntEvent @int, string key)
 {
     @int.PutInDic(key);
 }
Ejemplo n.º 5
0
 public void CreateIntEvent()
 {
     intEvent = ScriptableObject.CreateInstance <IntEvent> ();
 }
Ejemplo n.º 6
0
 public void RaiseInt(int value)
 {
     IntEvent?.Invoke(this, new IntEventArgs(value));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// UEvent数据写入无返回值字典
 /// </summary>
 /// <param name="int">UEvent</param>
 public void PutUEventInVoidDic(IntEvent @int)
 {
     @int.PutInDic();
 }
 static internal void PutInDic(this IntEvent @int)
 {
     PutInDic(@int, string.Format("{0}{1}", defaultKey, nameof(IntEvent)));
 }
 static internal void PutInDic(this IntEvent @int, out string key)
 {
     key = string.Format("{0}{1}{2}", defaultKey, nameof(IntEvent), KeyForXY(UnityEngine.Random.Range(1, 20), UnityEngine.Random.Range(1, 99)));
     PutInDic(@int, key);
 }
Ejemplo n.º 10
0
 public void OnIntEvent(int e)
 {
     IntEvent?.Invoke(this, e);
 }
Ejemplo n.º 11
0
 public static void AddCleanIntListener(this IntEvent @event, UnityAction <int> action)
 {
     @event.RemoveListener(action);
     @event.AddListener(action);
 }
Ejemplo n.º 12
0
 void Start()
 {
     instance = this;
     gameObject.SetActive(false);
     ButtonCallback = new IntEvent();
 }
Ejemplo n.º 13
0
 public void CallGenericInt()
 {
     IntEvent?.Invoke(this, new GenericEventArgs <int>(42));
 }
Ejemplo n.º 14
0
 private void Awake()
 {
     InventorySlotUpdated     = new IntEvent();
     InventorySelectedChanged = new IntEvent();
 }
 public static void AddOnce(this IntEvent thisEvent, UnityAction <int> reciever)
 {
     thisEvent.RemoveListener(reciever);
     thisEvent.AddListener(reciever);
 }
 static internal void PutInDic(this IntEvent @int, string key)
 {
     PutInDic <int>(@int, key);
 }
Ejemplo n.º 17
0
 public void CreateAppEventListenerAndAppEvent()
 {
     intEvent = ScriptableObject.CreateInstance <IntEvent> ();
     listener = new GameObject().AddComponent <IntEventListener> ();
 }
Ejemplo n.º 18
0
 private void Awake()
 {
     OnPopupFermer = new IntEvent();
 }