public void init(bool initBackground = true)
    {
        selected = false;
        isDraged = false;
        if (initBackground && GameplayController.Instance != null)
        {
            GameplayController.Instance.LoadBackground(background);
        }
        if (MiniGameController.Instance)
        {
            MiniGameController.Instance.hideAllGames();
        }
        if (StatusBubble != null)
        {
            StatusBubble.SetActive(false);
        }

        monsterBar.ButtonPrevious = ButtonPrevious.GetComponent <Button> ();
        monsterBar.ButtonNext     = ButtonNext.GetComponent <Button> ();

        monsterBar.onMonsterLocated += onMonsterLocated;
        monsterBar.onMonsterDrag    += onMonsterDrag;

        monsterBar.Init(true);
        if (lastMonsterIndex > -1)
        {
            monsterBar.JumpToMonsterIndex(lastMonsterIndex);
        }
        updateButtons();
    }
示例#2
0
    void OnEnable()
    {
        selectedMonster = null;
        if (GameplayController.Instance.ReaplaceBackground_SelectMonster == true)
        {
            GameplayController.Instance.LoadBackground();
            GameplayController.Instance.ReaplaceBackground_SelectMonster = false;
        }

//		if (UIController.Instance.LastPanel != UIController.Instance.DiscoverNewFriendsPanel) {
//			GameplayController.Instance.ReaplaceBackground_SelectMonster = true;
//		}

        monsterBar.ButtonPrevious = ButtonPrevious.GetComponent <Button> ();
        monsterBar.ButtonNext     = ButtonNext.GetComponent <Button> ();

        monsterBar.Init();
        monsterBar.onMonsterLocated += onMonsterLocated;
//		monsterBar.onMonsterDrag += onMonsterDrag;



        updateButtons();
        AudioController.Instance.PlaySound(InstructionSound);


        Invoke("addTutorialHandPosition", 0.5f);

/*
 * //Jonathan
 *              if (GameplayController.Instance.CurrentLevelIndex == 0) {
 *                      GameObject go;
 *                      Vector2 point = new Vector2(0, -140);
 *                      go = GameObject.Find ("Button - Ok");
 *                      if (go != null) {
 *                              point = go.transform.localPosition + new Vector3 (0, 100, 0);
 *                      } else {
 *                      }
 *              }
 *              //End Jonathan
 */


        if (TouchController != null)
        {
            TouchController.onBeginDrag    += OnBeginDrag;
            TouchController.onDrag         += OnDrag;
            TouchController.onEndDrag      += OnEndDrag;
            TouchController.onPointerClick += OnPointerClick;
        }

        Analitics.Instance.treckScreen("Monster Select");
    }