예제 #1
0
    public static void Show(VCEMsgBoxType type)
    {
        GameObject group = GameObject.Find(s_MsgBoxGroupName);

        if (group != null)
        {
            GameObject msgbox_go = GameObject.Instantiate(Resources.Load(s_MsgBoxResPath) as GameObject) as GameObject;
            Vector3    scale     = msgbox_go.transform.localScale;
            msgbox_go.name                    = "Message Box " + Time.frameCount.ToString() + " (" + type.ToString() + ")";
            msgbox_go.transform.parent        = group.transform;
            msgbox_go.transform.localPosition = Vector3.zero;
            msgbox_go.transform.localRotation = Quaternion.identity;
            msgbox_go.transform.localScale    = scale;
            VCEMsgBoxDesc desc   = new VCEMsgBoxDesc(type);
            VCEMsgBox     msgbox = msgbox_go.GetComponent <VCEMsgBox>();
            msgbox.m_Type            = type;
            msgbox.m_PopupFrame      = Time.frameCount;
            msgbox.m_Title.text      = desc.Title;
            msgbox.m_Message.text    = desc.Message;
            msgbox.m_Icon.spriteName = desc.Icon;
            msgbox.m_ButtonL.GetComponentsInChildren <UILabel>(true)[0].text = desc.ButtonL;
            msgbox.m_ButtonR.GetComponentsInChildren <UILabel>(true)[0].text = desc.ButtonR;
            msgbox.m_ButtonC.GetComponentsInChildren <UILabel>(true)[0].text = desc.ButtonC;
            if (desc.ButtonL.Length > 0)
            {
                msgbox.m_ButtonL.SetActive(true);
            }
            else
            {
                msgbox.m_ButtonL.SetActive(false);
            }
            if (desc.ButtonR.Length > 0)
            {
                msgbox.m_ButtonR.SetActive(true);
            }
            else
            {
                msgbox.m_ButtonR.SetActive(false);
            }
            if (desc.ButtonC.Length > 0)
            {
                msgbox.m_ButtonC.SetActive(true);
            }
            else
            {
                msgbox.m_ButtonC.SetActive(false);
            }
            if (type == VCEMsgBoxType.DELETE_ISO)
            {
                msgbox.m_ButtonL.GetComponentsInChildren <UILabel>(true)[0].color = Color.red;
            }
            msgbox_go.SetActive(true);
        }
    }
예제 #2
0
    public VCEMsgBoxDesc(VCEMsgBoxType type)
    {
        Title   = "";
        Message = "";
        Icon    = "";
        ButtonL = "";
        ButtonC = "";
        ButtonR = "";
        switch (type)
        {
        case VCEMsgBoxType.CLOSE_QUERY:
            Title   = "Quit and save".ToLocalizationString();
            Message = "Do you want to save the ISO before closing ?".ToLocalizationString();
            ButtonL = "Save".ToLocalizationString();
            ButtonC = "Don't Save".ToLocalizationString();
            ButtonR = "Cancel".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.CLOSE_QUERY_NOSAVE:
            Title   = "Quit".ToLocalizationString();
            Message = "Quit the Voxel Creation Editor ?".ToLocalizationString();
            ButtonL = "Quit".ToLocalizationString();
            ButtonR = "Don't Quit".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.SWITCH_QUERY:
            Title   = "Switch scene".ToLocalizationString();
            Message = "Swiching scene will reset the current scene !".ToLocalizationString() + "\r\n" + "Do you want to save the current scene as an ISO ?".ToLocalizationString();
            ButtonL = "Save".ToLocalizationString();
            ButtonR = "Don't Save".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.LOAD_QUERY:
            Title   = "Save ISO".ToLocalizationString();
            Message = "Do you want to save the current ISO before loading another ?".ToLocalizationString();
            ButtonL = "Save".ToLocalizationString();
            ButtonR = "Don't Save".ToLocalizationString();
            ButtonC = "Cancel".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.MATERIAL_NOT_SAVED:
            Title   = "Material not saved".ToLocalizationString();
            Message = "Save material list failed ! (Corrupt file or no permission)".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_error";
            break;

        case VCEMsgBoxType.MATERIAL_DEL_QUERY:
            Title   = "Delete material".ToLocalizationString();
            Message = "Do you really want to delete this material ?".ToLocalizationString() + "\r\n " + "You still can restore it from the ISO which contains it.".ToLocalizationString();
            ButtonL = "DELETE".ToLocalizationString();
            ButtonR = "Cancel".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.DECAL_NOT_SAVED:
            Title   = "Decal not saved".ToLocalizationString();
            Message = "Save decal list failed ! (Corrupt file or no permission)".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_error";
            break;

        case VCEMsgBoxType.DECAL_DEL_QUERY:
            Title   = "Delete decal".ToLocalizationString();
            Message = "Do you really want to delete this decal ?".ToLocalizationString() + "\r\n" + "You still can restore it from the ISO which contains it.".ToLocalizationString();
            ButtonL = "DELETE".ToLocalizationString();
            ButtonR = "Cancel".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.DELETE_ISO:
            Title   = "!! Delete ISO !!".ToLocalizationString();
            Message = "Do you really want to delete this ISO ?".ToLocalizationString() + "\r\n" + "This action cannot be undone !".ToLocalizationString();
            ButtonL = "DELETE".ToLocalizationString();
            ButtonR = "Cancel".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.MISSING_ISO:
            Title   = "Loading failed".ToLocalizationString();
            Message = "The source file of this ISO is missing !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_error";
            break;

        case VCEMsgBoxType.CORRUPT_ISO:
            Title   = "Loading failed".ToLocalizationString();
            Message = "The source file of this ISO is corrupt !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_error";
            break;

        case VCEMsgBoxType.CANNOT_SAVE_NONAME:
            Title   = "Cannot save".ToLocalizationString();
            Message = "An ISO name must be assigned !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_deny";
            break;

        case VCEMsgBoxType.REPLACE_QUERY:
            Title   = "!! WARNING !!".ToLocalizationString();
            Message = "Do you want to overwrite the old ISO ?".ToLocalizationString();
            ButtonL = "REPLACE".ToLocalizationString();
            ButtonR = "Cancel".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.SAVE_OK:
            Title   = "Save OK".ToLocalizationString();
            Message = "The current ISO saved successfully !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_ok";
            break;

        case VCEMsgBoxType.SAVE_FAILED:
            Title   = "Error".ToLocalizationString();
            Message = "Failed to save the current ISO !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_error";
            break;

        case VCEMsgBoxType.ISO_INCOMPLETE:
            Title   = "ISO incomplete".ToLocalizationString();
            Message = "The current ISO is incomplete, cannot save or export !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_deny";
            break;

        case VCEMsgBoxType.ISO_INVALID:
            Title   = "ISO invalid".ToLocalizationString();
            Message = "The current ISO is invalid !".ToLocalizationString() + "\r\n" + "Please correct your templates !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_deny";
            break;

        case VCEMsgBoxType.EXPORT_OK:
            Title   = "Export OK".ToLocalizationString();
            Message = "The creation exported successfully. Enjoy !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_ok";
            break;

        case VCEMsgBoxType.EXPORT_NETWORK_FAILED:
            Title   = "Error".ToLocalizationString();
            Message = "Creation uploading failed !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_error";
            break;

        case VCEMsgBoxType.EXPORT_EMPTY_NAME:
            Title   = "Error".ToLocalizationString();
            Message = "Creation name cannot be empty !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_error";
            break;

        case VCEMsgBoxType.EXPORT_NETWORK:
            Title   = "!! WARNING !!".ToLocalizationString();
            Message = "NOTE : Your creation is uploading to the workshop, you will receive it later!".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.EXPORT_EXISTNAME:
            Title   = "Error".ToLocalizationString();
            Message = "Failed to export due to an existing iso name with different data! Please rename it.".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_error";
            break;

        case VCEMsgBoxType.EXPORT_FAILED:
            Title   = "Error".ToLocalizationString();
            Message = "Failed to export the item due to saving resource failure !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_error";
            break;

        case VCEMsgBoxType.EXPORT_NOTSAVED:
            Title   = "Hint".ToLocalizationString();
            Message = "You need to save the current ISO first !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.EXPORT_FULL:
            Title   = "Hint".ToLocalizationString();
            Message = "Your bag is full , please sort out your bag first !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.CANNOT_EXPORT_NOW:
            Title   = "Cannot export now".ToLocalizationString();
            Message = "You cannot export now, because something is now exporting !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_alert";
            break;

        case VCEMsgBoxType.CANNOT_EXTRUDE:
            Title   = "Extrude".ToLocalizationString();
            Message = "The editor cannot EXTRUDE more than 8000 voxels at a time !".ToLocalizationString();
            ButtonC = "OK".ToLocalizationString();
            Icon    = "msgbox_deny";
            break;

        default:
            Title   = "";
            Message = "Undefined Message Box".ToLocalizationString();
            Icon    = "msgbox_error";
            ButtonL = "";
            ButtonC = "OK".ToLocalizationString();
            ButtonR = "";
            break;
        }
    }
예제 #3
0
    public static void Response(VCEMsgBoxType type, VCEMsgBoxButton button, int frameindex)
    {
        switch (type)
        {
        case VCEMsgBoxType.CLOSE_QUERY:
        {
            if (button == VCEMsgBoxButton.L)
            {
                VCEditor.Instance.m_UI.OnSaveClick();
            }
            else if (button == VCEMsgBoxButton.C)
            {
                VCEditor.Quit();
            }
            break;
        }

        case VCEMsgBoxType.CLOSE_QUERY_NOSAVE:
        {
            if (button == VCEMsgBoxButton.L)
            {
                VCEditor.Quit();
            }
            break;
        }

        case VCEMsgBoxType.SWITCH_QUERY:
        {
            if (button == VCEMsgBoxButton.L)
            {
                VCEditor.Instance.m_UI.OnSaveClick();
            }
            else if (button == VCEMsgBoxButton.R)
            {
                VCEUISceneMenuItem.DoCreateSceneFromMsgBox();
            }
            VCEUISceneMenuItem.s_SceneToCreate = null;
            break;
        }

        case VCEMsgBoxType.LOAD_QUERY:
        {
            if (button == VCEMsgBoxButton.L)
            {
                VCEditor.Instance.m_UI.OnSaveClick();
            }
            else if (button == VCEMsgBoxButton.R)
            {
                VCEUIIsoItem.DoLoadFromMsgBox();
            }
            VCEUIIsoItem.s_IsoToLoad = "";
            break;
        }

        case VCEMsgBoxType.MATERIAL_DEL_QUERY:
        {
            if (button == VCEMsgBoxButton.L)
            {
                VCEUIMaterialItem.DoDeleteFromMsgBox();
            }
            VCEUIMaterialItem.s_CurrentDelMat = null;
            break;
        }

        case VCEMsgBoxType.DECAL_DEL_QUERY:
        {
            if (button == VCEMsgBoxButton.L)
            {
                VCEUIDecalItem.DoDeleteFromMsgBox();
            }
            VCEUIDecalItem.s_CurrentDelDecal = null;
            break;
        }

        case VCEMsgBoxType.DELETE_ISO:
        {
            if (button == VCEMsgBoxButton.L)
            {
                VCEUIIsoItem.DoDeleteFromMsgBox();
            }
            VCEUIIsoItem.s_IsoToDelete = "";
            break;
        }

        case VCEMsgBoxType.MISSING_ISO:
        {
            break;
        }

        case VCEMsgBoxType.CORRUPT_ISO:
        {
            break;
        }

        case VCEMsgBoxType.CANNOT_SAVE_NONAME:
        {
            break;
        }

        case VCEMsgBoxType.REPLACE_QUERY:
        {
            if (button == VCEMsgBoxButton.L)
            {
                VCEUISaveWnd.DoSaveForOverwrite();
            }
            VCEUISaveWnd.s_SaveTargetForOverwrite = "";
            break;
        }

        case VCEMsgBoxType.SAVE_OK:
        {
            break;
        }

        case VCEMsgBoxType.SAVE_FAILED:
        {
            break;
        }

        case VCEMsgBoxType.ISO_INCOMPLETE:
        {
            break;
        }

        case VCEMsgBoxType.ISO_INVALID:
        {
            break;
        }

        case VCEMsgBoxType.EXPORT_OK:
        {
            VCEditor.Instance.m_UI.m_ExportWindow.Hide();
            break;
        }

        case VCEMsgBoxType.EXPORT_NETWORK:
        {
            VCEditor.Instance.m_UI.m_ExportWindow.Hide();
            break;
        }

        case VCEMsgBoxType.EXPORT_FAILED:
        {
            break;
        }

        case VCEMsgBoxType.EXPORT_NOTSAVED:
        {
            VCEditor.Instance.m_UI.OnSaveAsClick();
            break;
        }

        case VCEMsgBoxType.EXPORT_FULL:
        {
            break;
        }

        case VCEMsgBoxType.CANNOT_EXPORT_NOW:
        {
            break;
        }

        case VCEMsgBoxType.CANNOT_EXTRUDE:
        {
            break;
        }
        }
    }