Exemplo n.º 1
0
    /// <summary>
    /// 将游戏打包成ios或Android 后运行的,打包成assetbundle
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    private IEnumerator OnCreatePanel(DialogType type)
    {
        path = Util.AppContentDataUri + "UI/" + type.ToString() + "Panel.unity3d";
        GameObject go = null;

        WWW bundle = new WWW(path);
        yield return bundle;  //等待加载完成后进行其他操作

        try
        {
            if (bundle.assetBundle.Contains(type.ToString()+"Panel"))
            {
                go =
                    Instantiate(bundle.assetBundle.LoadAsset(type.ToString() + "Panel", typeof (GameObject))) as
                        GameObject;
            }
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());   
        }

        go.name = type.ToString() + "Panel";
        go.transform.parent = UIContainer.instance.transform;
        go.transform.localPosition = Vector3.zero;
        go.transform.localScale = Vector3.one;
        bundle.assetBundle.Unload(false);  //加载完成后卸载
    }
Exemplo n.º 2
0
    /// <summary>
    /// ダイアログの種類を指定しResoucesから対象のプレハブを返す
    /// </summary>
    public DialogBase GetDialog(DialogType type)
    {
        Debug.Log("Dialog/" + type.ToString());
        GameObject dialog = (GameObject)Resources.Load("Dialog/" + type.ToString());

        return(dialog.GetComponent <DialogBase>());
    }
Exemplo n.º 3
0
        public static InfoRecord GetDialogInfo(DialogType type, Character npc, Character player, string key = null, int choice = -1)
        {
            switch (type)
            {
            case DialogType.Greeting:
                foreach (var greeting in GreetingCache)
                {
                    var info = greeting.Value.GetInfo(player, npc);
                    if (info != null)
                    {
                        return(info);
                    }
                }
                return(null);

            case DialogType.Journal:
                return(JournalCache[key].GetInfo(player, npc, choice));

            case DialogType.Persuasion:
                return(PersuasionCache[key].GetInfo(player, npc, choice));

            case DialogType.Voice:
                return(VoiceCache[key].GetInfo(player, npc, choice));

            case DialogType.Topic:
            default:
                throw new NotImplementedException(type.ToString());
            }
        }
        protected virtual IDialogWindow CreateWindow(object parentViewModel, FrameworkElement contentView,
                                                     DialogType type)
        {
            IDialogWindow win;

            switch (type)
            {
            case DialogType.Dialog:
                win = CreateDialogWindow(parentViewModel, contentView);
                break;

            case DialogType.Model:
                win = CreateChildWindow(parentViewModel, contentView);
                break;

            case DialogType.Auto:
                throw new NotSupportedException(type.ToString());

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            win.Owner = GetLatestOpeningWindow();
            AddToCache(parentViewModel, win);

            return(win);
        }
Exemplo n.º 5
0
    public static bool MessageBox(string title, string message, DialogType dialogType, IconType iconType, bool okDefault)
    {
        string dialog = dialogType.ToString( ).ToLower( );
        string icon   = iconType.ToString( ).ToLower( );

        return(tinyfd_messageBox(title, message, dialog, icon, okDefault ? 1 : 0) == 1);
    }
 /// <summary>
 /// Show message in a dialog.
 /// </summary>
 /// <returns><c>true</c>, if ok/yes was clicked, <c>false</c> otherwise.</returns>
 /// <param name="title">Title.</param>
 /// <param name="message">Message.</param>
 /// <param name="dialogType">Dialog type.</param>
 /// <param name="iconType">Icon type.</param>
 /// <param name="okIsDefault">If set to <c>true</c>, OK/Yes is the default selected button, otherwise Cancel/No is default.</param>
 public static bool MessageBox(
     string title,
     string message,
     DialogType dialogType = DialogType.ok,
     IconType iconType     = IconType.info,
     bool okIsDefault      = true
     )
 {
     return(0 != tinyfd_messageBox(title, message, dialogType.ToString(), iconType.ToString(), okIsDefault ? 1 : 0));
 }
Exemplo n.º 7
0
    private IEnumerator OnCreatePanel(DialogType type)
    {
        path = Util.AppContentDataUri + "UI/" + type.ToString() + "Panel.unity3d";
        GameObject go = null;

        WWW bundle = new WWW(path);

        yield return(bundle);

        try
        {
            if (bundle.assetBundle.Contains(type.ToString() + "Panel"))
            {
                go = Instantiate(bundle.assetBundle.Load(type.ToString() + "Panel", typeof(GameObject))) as GameObject;
            }
        }
        catch (System.Exception ex)
        {
            NGUIDebug.Log("catch go....  " + ex.ToString());
        }

        go.name = type.ToString() + "Panel";
        if (type.ToString() == "Main")
        {
            Util.SetBackground("MainUI/MainGround");
            go.transform.localScale    = Vector3.one;
            go.transform.localPosition = Vector3.zero;
        }
        else
        {
            if (type.ToString() != "World" && type.ToString() != "Summon" && type.ToString() != "SummonTips")
            {
                Util.SetBackground(null);
            }

            go.transform.parent        = UIContainer.instance.transform;
            go.transform.localScale    = Vector3.one;
            go.transform.localPosition = Vector3.zero;
        }

        bundle.assetBundle.Unload(false);
    }
Exemplo n.º 8
0
 public OperationResult CreateDialog(DialogType dialogType, params object[] parameters)
 {
     return(CreateDialog(dialogType.ToString(), parameters));
 }
Exemplo n.º 9
0
 public BsDialog Type(DialogType type)
 {
     Attributes["type"] = string.Format("BootstrapDialog.TYPE_{0}", type.ToString().ToUpper());
     SetScript();
     return(this);
 }
Exemplo n.º 10
0
 internal DialogInfo(DialogType type, string title, string msg)
 {
     DialogTypeStr = type.ToString();
     Title         = title;
     Message       = msg;
 }
Exemplo n.º 11
0
 public Dialog Type(DialogType value)
 {
     type = "panel-" + value.ToString().ToLower();
     return(this);
 }
Exemplo n.º 12
0
        public void ShowDialog(DialogType type, CharacterPos cPos, CharacterType chType, string text, bool isDisplayContinue, Rect rectPanel, int hatIndex, bool hideTipball = false)
        {
            if (_dialog == null)
            {
                var go = Instantiate(ResourceLoadUtils.Load <GameObject>("Framework/Core/Tutorial/Dialog/Dialog")) as GameObject;
                _dialog = go.transform as RectTransform;
                _dialog.SetParent(SwitchTransform, false);
                _dialog.localScale = Vector3.one;
            }
            _dialog.gameObject.SetActive(false);

            RectTransform root        = _dialog.Find(type.ToString()) as RectTransform;
            Text          contentText = null;

            for (int i = 0; i < _dialog.childCount; ++i)
            {
                var go = _dialog.GetChild(i).gameObject;
                go.SetActive(type.ToString() == go.name);
                if (type.ToString() == go.name)
                {
                    contentText = go.transform.Find("Background/Text").GetComponent <Text>();
                }
            }
            if (contentText)
            {
                contentText.text = text;
            }
            Transform rtrans = null;

            switch (type)
            {
            case DialogType.Anywhere:
                root.anchorMin = new Vector2(rectPanel.xMin, rectPanel.yMin);
                root.anchorMax = new Vector2(rectPanel.xMax, rectPanel.yMax);

                for (CharacterPos i = 0; i < CharacterPos.Count; ++i)
                {
                    var parentTrans = root.Find("Background/" + i.ToString() + "/Tipball");
                    parentTrans.parent.gameObject.SetActive(i == cPos);
                    if (i == cPos)
                    {
                        rtrans = parentTrans;
                        var  anchorPos = (rtrans.parent as RectTransform).anchoredPosition;
                        Rect rootRect  = UIUtils.GetRectInCanvas(GetCanvas(), root.Find("Background") as RectTransform);
                        switch (cPos)
                        {
                        case CharacterPos.BottomLeft:
                            (rtrans.parent as RectTransform).anchoredPosition = new Vector2(rootRect.width * -.3f, anchorPos.y);
                            break;

                        case CharacterPos.BottomRight:
                            (rtrans.parent as RectTransform).anchoredPosition = new Vector2(rootRect.width * .3f, anchorPos.y);
                            break;
                        }
                    }
                }
                root.Find("Background/ClickContinuePic").gameObject.SetActive(isDisplayContinue);
                break;

            case DialogType.Bottom:
                rtrans = root.Find("Background/Tipball");
                root.Find("Background/ClickContinuePic").gameObject.SetActive(isDisplayContinue);
                break;
            }
            for (int i = 0; i < _tipBalls.Length; ++i)
            {
                if ((int)chType == i && !hideTipball)
                {
                    if (_tipBalls[i] == null)
                    {
                        _tipBalls[i] = Instantiate(ResourceLoadUtils.Load <GameObject>("Framework/Core/Tutorial/Dialog/" + chType.ToString()), rtrans, false);
                    }
                    else
                    {
                        _tipBalls[i].transform.SetParent(rtrans, false);
                        _tipBalls[i].SetActive(true);
                    }
                    for (int j = 0; j < _tipBalls[i].transform.childCount; j++)
                    {
                        _tipBalls[i].transform.GetChild(j).gameObject.SetActive(hatIndex == j);
                    }
                }
                else
                {
                    if (_tipBalls[i])
                    {
                        _tipBalls[i].SetActive(false);
                    }
                }
            }

            _dialog.gameObject.SetActive(true);
            EnableParentCanvasRaycaster(_dialog);
        }
 public RequestDialog(DialogType type, object param, bool primary) : this(type.ToString(), param, primary)
 {
 }
 public RequestDialog(DialogType type, object param) : this(type.ToString(), param, false)
 {
 }