private void Start()
 {
     jsonScript        = FindObjectOfType <ReadInDialogue>();
     globalDioTimeline = FindObjectOfType <DioTimeline>();
     UIPopUp           = FindObjectOfType <UIPopUp>();
     marriageMeter     = FindObjectOfType <MarriageMeter>();
 }
        private void Awake()
        {
            if (instance != null)
            {
                Destroy(gameObject);
                return;
            }

            instance = this;
            popUp    = GetComponent <UIPopUp>();
        }
Пример #3
0
        private void Start()
        {
            if (Instance == null)
            {
                Instance = this;
            }
            else
            {
                Destroy(this);
            }

            if (!PopUpScript)
            {
                PopUpScript = gameObject.GetComponent <UIPopUp>();
            }
        }
    // Use this for initialization
    private void OnEnable()
    {
        jsonScript        = FindObjectOfType <ReadInDialogue>();
        globalDioTimeline = FindObjectOfType <DioTimeline>();
        UIPopUp           = FindObjectOfType <UIPopUp>();
        marriageMeter     = FindObjectOfType <MarriageMeter>();

        //Spouce Image set code

        if (globalDioTimeline.spouceNum == 1)
        {
            if (marriageMeter.marriageMeter <= 100 && marriageMeter.marriageMeter > 75)
            {
                dioImage.GetComponent <Image>().sprite = spouce1[0];
            }
            else if (marriageMeter.marriageMeter <= 75 && marriageMeter.marriageMeter > 50)
            {
                dioImage.GetComponent <Image>().sprite = spouce1[1];
            }
            else if (marriageMeter.marriageMeter <= 50 && marriageMeter.marriageMeter > 25)
            {
                dioImage.GetComponent <Image>().sprite = spouce1[2];
            }
            else if (marriageMeter.marriageMeter <= 25 && marriageMeter.marriageMeter >= 0)
            {
                dioImage.GetComponent <Image>().sprite = spouce1[3];
            }
        }
        else if (globalDioTimeline.spouceNum == 2)
        {
            if (marriageMeter.marriageMeter <= 100 && marriageMeter.marriageMeter > 75)
            {
                dioImage.GetComponent <Image>().sprite = spouce2[0];
            }
            else if (marriageMeter.marriageMeter <= 75 && marriageMeter.marriageMeter > 50)
            {
                dioImage.GetComponent <Image>().sprite = spouce2[1];
            }
            else if (marriageMeter.marriageMeter <= 50 && marriageMeter.marriageMeter > 25)
            {
                dioImage.GetComponent <Image>().sprite = spouce2[2];
            }
            else if (marriageMeter.marriageMeter <= 25 && marriageMeter.marriageMeter >= 0)
            {
                dioImage.GetComponent <Image>().sprite = spouce2[3];
            }
        }
        else if (globalDioTimeline.spouceNum == 3)
        {
            if (marriageMeter.marriageMeter <= 100 && marriageMeter.marriageMeter > 75)
            {
                dioImage.GetComponent <Image>().sprite = spouce3[0];
            }
            else if (marriageMeter.marriageMeter <= 75 && marriageMeter.marriageMeter > 50)
            {
                dioImage.GetComponent <Image>().sprite = spouce3[1];
            }
            else if (marriageMeter.marriageMeter <= 50 && marriageMeter.marriageMeter > 25)
            {
                dioImage.GetComponent <Image>().sprite = spouce3[2];
            }
            else if (marriageMeter.marriageMeter <= 25 && marriageMeter.marriageMeter >= 0)
            {
                dioImage.GetComponent <Image>().sprite = spouce3[3];
            }
        }

        if (currentDio != globalDioTimeline.globalDio)
        {
            currentDio  = globalDioTimeline.globalDio;
            pointsAdded = false;
        }

        currentText = "";
        gameObject.GetComponent <Text>().text = currentText;
        fullText = jsonScript.dialogues[currentDio].text;

        if (jsonScript.dialogues[currentDio].type == "question")
        {
            question = true;
        }
        else
        {
            question = false;
            if (pointsAdded == false)
            {
                marriageMeter.marriageMeter = marriageMeter.marriageMeter + 5;
                pointsAdded = true;
            }
        }


        correctResponse = jsonScript.dialogues[currentDio].answer;


        StartCoroutine(ShowText());
        // AudioSource.PlayClipAtPoint(speech, gameObject.transform.position, 2.0f);
    }
Пример #5
0
 public UIPopUp()
 {
     instance = this;
 }
Пример #6
0
    // Start is called before the first frame update

    private void Awake()
    {
        anim = GetComponent <UIPopUp>();
    }
Пример #7
0
	public void OnDrawGizmos(){
		
		if(Selection.activeGameObject != null && !Application.isPlaying && this.EditorAutoScreenChange){
            
			// If the UIScreen selected is part of this UIScreenManager
			if(Selection.activeGameObject.GetComponentInParent<UIScreen>() != null && this.Screens.Contains(Selection.activeGameObject.GetComponentInParent<UIScreen>())){
				
				this.OpenScreen(Selection.activeGameObject.GetComponentInParent<UIScreen>());

				// Close popups
				this.CurrentPopUp = null;
				this.CloseAllPopUp();
				this.HidePopUp();

			}
			// If the UIPopupSelected is part of this UIScreenManager
			else if(Selection.activeGameObject.GetComponentInParent<UIPopUp>() != null && this.Popups.Contains(Selection.activeGameObject.GetComponentInParent<UIPopUp>())){
                //this.PopupCanvas.enabled = true;
				this.OpenPopUp(Selection.activeGameObject.GetComponentInParent<UIPopUp>());
                

            }
			// If the UIDialogSelected is part of this UIScreenManager
			else if(Selection.activeGameObject.GetComponentInParent<UIDialog>() != null && this.Dialogs.Contains(Selection.activeGameObject.GetComponentInParent<UIDialog>())){
                //this.DialogCanvas.enabled = true;
				this.OpenDialog(Selection.activeGameObject.GetComponentInParent<UIDialog>(), null);
                
            }
			else{
				this.CurrentScreen = null;
				this.CloseAllScreen();
				this.CurrentPopUp = null;
				this.CloseAllPopUp();
				this.HidePopUp();
				this.CurrentDialog = null;
				this.CloseAllDialog();
				this.HideDialog();
			}

		}

	}
Пример #8
0
    /// <summary>
    /// Opens the pop up.
    /// </summary>
    /// <param name="uip">Popup to open.</param>
    public void OpenPopUp(UIPopUp uip){

		// Setup the last screen var
		if (uip != this.CurrentPopUp) {
			this.LastUIPopup = this.CurrentPopUp;
		}

		//Debug.Log ("UIScreenManager.OpenScreen - "+uis.name);
		this.CurrentPopUp = uip;	
		
		this.CloseAllPopUp ();

		this.ShowPopUp ();
        uip.OpenPopUp();
    }