Beispiel #1
0
    public static PopoutController CreatePopoutUnitSpeak(string unitName, string message
                                                         , string unitImageAddress
                                                         , int sortingoder
                                                         , bool dismissAfterTapBtn, PopoutWIndowAlertType type
                                                         , Action <PopoutController, PopoutWindowAlertActionType> action = null)
    {
        string name = popoutPrefabName;

        UnityEngine.Object prefab = null;
        name = "Windows/PopoutUnitSpeak";
        if (popoutMessage == null)
        {
            Debug.Log("Loading popout file " + name);
            popoutMessage = Resources.Load(name);
            DontDestroyOnLoad(popoutMessage);
        }
        prefab = popoutMessage;
        GameObject tf = Instantiate(prefab) as GameObject;
        //tf.transform.position = pos;
        PopoutController pop = tf.GetComponent <PopoutController>();

        pop.Setup(unitName, message, sortingoder, dismissAfterTapBtn, type, action);
        pop.panelBgImg1.sprite = Resources.Load <Sprite>(unitImageAddress);
        pop.fadeEndScale       = Vector3.zero;
        return(pop);
    }
Beispiel #2
0
    public static PopoutController CreatePopoutAlert(string title, string message, int sortingoder
                                                     , bool dismissAfterTapBtn, PopoutWIndowAlertType type
                                                     , Action <PopoutController, PopoutWindowAlertActionType> action = null
                                                     , string style = "")
    {
        string name = popoutPrefabName;

        UnityEngine.Object prefab = null;
        if (style == "con")
        {
            name = "Windows/PopoutConfirmCon";
            if (popout1 == null)
            {
                Debug.Log("Loading popout file " + name);
                popout1 = Resources.Load(name);
                DontDestroyOnLoad(popout1);
            }
            prefab = popout1;
        }
        else
        {
            if (popout0 == null)
            {
                Debug.Log("Loading popout file " + name);
                popout0 = Resources.Load(name);
                DontDestroyOnLoad(popout0);
            }
            prefab = popout0;
        }
        Debug.Log("Loading file " + name);
        GameObject       tf  = Instantiate(prefab) as GameObject;
        PopoutController pop = tf.GetComponent <PopoutController>();

        pop.Setup(title, message, sortingoder, dismissAfterTapBtn, type, action);
        //SDGameManager.Instance.audio
        return(pop);
    }
Beispiel #3
0
    public static PopoutController CreateDamagePopoutMessage(string fontname, Vector3 pos
                                                             , string message, int sortingoder
                                                             , Action <PopoutController, PopoutWindowAlertActionType> action = null)
    {
        string name = popoutPrefabName;

        UnityEngine.Object prefab = null;
        name = "Windows/PopoutDamageMessage";
        switch (fontname)
        {
        case "font1": name += "1"; break;

        case "font2": name += "2"; break;

        case "font3": name += "3"; break;

        default: break;
        }
        if (popoutMessage == null)
        {
            Debug.Log("Loading popout file" + name);
            popoutMessage = Resources.Load(name);
            DontDestroyOnLoad(popoutMessage);
        }
        prefab = popoutMessage;

        GameObject tf = Instantiate(prefab) as GameObject;

        tf.transform.position = pos;
        PopoutController pop = tf.GetComponent <PopoutController>();

        pop.Setup
            ("", "-" + message, sortingoder, true
            , PopoutWIndowAlertType.MessageDismissWithDelay, action);
        return(pop);
    }