Пример #1
0
    public void OnSaveClick()
    {
        m_Iso.m_HeadInfo.Author = m_AuthorInput.text;
        string   targetpath = VCConfig.s_IsoPath + m_SaveLocInput.text + VCConfig.s_IsoFileExt;
        FileInfo fi_doc     = new FileInfo(VCConfig.s_IsoPath + VCEditor.s_Scene.m_DocumentPath);
        FileInfo fi_tar     = new FileInfo(targetpath);
        bool     result     = false;

        if (fi_doc.FullName.ToLower() == fi_tar.FullName.ToLower())
        {
            result = VCEditor.s_Scene.SaveIso();
            VCEMsgBox.Show(result ? VCEMsgBoxType.SAVE_OK : VCEMsgBoxType.SAVE_FAILED);
        }
        else
        {
            if (File.Exists(fi_tar.FullName))
            {
                s_SaveTargetForOverwrite = m_SaveLocInput.text + VCConfig.s_IsoFileExt;
                VCEMsgBox.Show(VCEMsgBoxType.REPLACE_QUERY);
            }
            else
            {
                result = VCEditor.s_Scene.SaveIsoAs(m_SaveLocInput.text + VCConfig.s_IsoFileExt);
                VCEMsgBox.Show(result ? VCEMsgBoxType.SAVE_OK : VCEMsgBoxType.SAVE_FAILED);
            }
        }
        Hide();
    }
Пример #2
0
 public void OnSaveClick()
 {
     if (VCEditor.s_ProtectLock0)
     {
         return;
     }
     VCEditor.ClearSelections();
     m_StatPanel.OnCreationInfoRefresh();
     if (File.Exists(VCConfig.s_IsoPath + VCEditor.s_Scene.m_DocumentPath))
     {
         if (VCEditor.s_Scene.SaveIso())
         {
             VCEMsgBox.Show(VCEMsgBoxType.SAVE_OK);
         }
         else
         {
             VCEMsgBox.Show(VCEMsgBoxType.SAVE_FAILED);
         }
         if (m_ISOTab.isChecked)
         {
             m_IsoList.RefreshIsoList();
         }
     }
     else
     {
         OnSaveAsClick();
     }
 }
Пример #3
0
 public void OnDelClick()
 {
     s_CurrentDelDecal = VCEAssetMgr.GetDecal(m_GUID);
     if (s_CurrentDelDecal != null)
     {
         VCEMsgBox.Show(VCEMsgBoxType.DECAL_DEL_QUERY);
     }
 }
Пример #4
0
 // ----------- Submit ------------------------
 void Apply()
 {
     if (m_Target != null)
     {
         ulong old_guid           = 0;
         ulong new_guid           = 0;
         bool  need_update_isomat = (VCEditor.s_Scene.m_IsoData.QueryMaterial(m_Target.m_Guid) != null);
         if (VCEAssetMgr.s_Materials.ContainsKey(m_Target.m_Guid))
         {
             old_guid = m_Target.m_Guid;
             if (!VCEAssetMgr.DeleteMaterialDataFile(m_Target.m_Guid))
             {
                 VCEMsgBox.Show(VCEMsgBoxType.MATERIAL_NOT_SAVED);
             }
             VCEAssetMgr.s_Materials.Remove(m_Target.m_Guid);
             m_Target.Import(m_TempMaterial.Export());
             new_guid = m_Target.m_Guid;
             VCEAssetMgr.s_Materials.Add(m_Target.m_Guid, m_Target);
             if (!VCEAssetMgr.CreateMaterialDataFile(m_Target))
             {
                 VCEMsgBox.Show(VCEMsgBoxType.MATERIAL_NOT_SAVED);
             }
         }
         else if (VCEAssetMgr.s_TempMaterials.ContainsKey(m_Target.m_Guid))
         {
             old_guid = m_Target.m_Guid;
             VCEAssetMgr.s_TempMaterials.Remove(m_Target.m_Guid);
             m_Target.Import(m_TempMaterial.Export());
             new_guid = m_Target.m_Guid;
             VCEAssetMgr.s_TempMaterials.Add(m_Target.m_Guid, m_Target);
         }
         else
         {
             Debug.LogError("What the hell is that ?!");
             old_guid = m_Target.m_Guid;
             m_Target.Import(m_TempMaterial.Export());
             new_guid = m_Target.m_Guid;
             VCEAssetMgr.s_Materials.Add(m_Target.m_Guid, m_Target);
             if (!VCEAssetMgr.CreateMaterialDataFile(m_Target))
             {
                 VCEMsgBox.Show(VCEMsgBoxType.MATERIAL_NOT_SAVED);
             }
         }
         VCEAlterMaterialMap.MatChange(old_guid, new_guid);
         if (need_update_isomat)
         {
             VCEditor.s_Scene.GenerateIsoMat();
         }
         VCEditor.SelectedMaterial = m_Target;
         VCEditor.Instance.m_UI.m_MaterialList.RefreshMaterialListThenFocusOnSelected();
         VCEditor.SelectedMaterial = m_Target;
     }
     else
     {
         Debug.LogError("No target material, Create new material instead !");
         CreateAsNew();
     }
 }
Пример #5
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);
        }
    }
Пример #6
0
    public void OnExportClick()
    {
        // Make Creation
        int r = VCEditor.MakeCreation();

        if (r == -4)           // Inventory is full
        {
            return;
        }
        if (!VCEditor.s_MultiplayerMode)
        {
            VCEMsgBox.Show((r == 0) ? VCEMsgBoxType.EXPORT_OK : VCEMsgBoxType.EXPORT_FAILED);
        }
    }
Пример #7
0
 public void OnAddClick()
 {
     if (VCEAssetMgr.AddMaterialFromTemp(m_Material.m_Guid))
     {
         VCEditor.SelectedMaterial = m_Material;
         VCEditor.Instance.m_UI.m_MaterialWindow.Reset(m_Material);
         VCEditor.Instance.m_UI.m_MaterialList.RefreshMaterialList(VCEditor.Instance.m_UI.m_MatterPopupList.selection);
         VCEStatusBar.ShowText("Add material".ToLocalizationString() + " [" + m_Material.m_Name + "] " + "from the current ISO".ToLocalizationString() + " !", 6f, true);
     }
     else
     {
         VCEMsgBox.Show(VCEMsgBoxType.MATERIAL_NOT_SAVED);
     }
     s_CurrentDelMat = null;
 }
Пример #8
0
 public void OnExportClick()
 {
     if (VCEditor.s_ProtectLock0)
     {
         return;
     }
     VCEditor.ClearSelections();
     m_StatPanel.OnCreationInfoRefresh();
     if (!File.Exists(VCConfig.s_IsoPath + VCEditor.s_Scene.m_DocumentPath))
     {
         VCEMsgBox.Show(VCEMsgBoxType.EXPORT_NOTSAVED);
         return;
     }
     m_ExportWindow.Show();
 }
Пример #9
0
    public static void DoDeleteFromMsgBox()
    {
        string sguid = s_CurrentDelDecal.GUIDString;

        if (VCEAssetMgr.DeleteDecal(s_CurrentDelDecal.m_Guid))
        {
            VCEditor.SelectedDecal = null;
            VCEditor.Instance.m_UI.m_DecalList.RefreshDecalList();
            VCEStatusBar.ShowText("Decal".ToLocalizationString() + " [" + sguid + "] " + "has been deleted".ToLocalizationString() + " !", 6f, true);
        }
        else
        {
            VCEMsgBox.Show(VCEMsgBoxType.DECAL_NOT_SAVED);
        }
    }
Пример #10
0
 public void OnAddClick()
 {
     if (VCEAssetMgr.AddDecalFromTemp(m_GUID))
     {
         VCDecalAsset decal = VCEAssetMgr.GetDecal(m_GUID);
         VCEditor.SelectedDecalGUID = m_GUID;
         m_ParentList.RefreshDecalList();
         VCEStatusBar.ShowText("Add decal".ToLocalizationString() + " [" + decal.GUIDString + "] " + "from the current ISO".ToLocalizationString() + " !", 6f, true);
     }
     else
     {
         VCEMsgBox.Show(VCEMsgBoxType.DECAL_NOT_SAVED);
     }
     s_CurrentDelDecal = null;
 }
Пример #11
0
 public void OnQuitClick()
 {
     if (VCEditor.s_ProtectLock0)
     {
         return;
     }
     if (VCEHistory.s_Modified)
     {
         VCEMsgBox.Show(VCEMsgBoxType.CLOSE_QUERY);
     }
     else
     {
         VCEditor.Quit();
     }
 }
Пример #12
0
    void CreateAsNew()
    {
        VCMaterial newmat = new VCMaterial();

        newmat.Import(m_TempMaterial.Export());
        VCEAssetMgr.s_Materials.Add(newmat.m_Guid, newmat);
        if (!VCEAssetMgr.CreateMaterialDataFile(newmat))
        {
            VCEMsgBox.Show(VCEMsgBoxType.MATERIAL_NOT_SAVED);
        }

        VCEditor.SelectedMaterial = newmat;
        VCEditor.Instance.m_UI.m_MaterialList.RefreshMaterialListThenFocusOnSelected();
        VCEditor.SelectedMaterial = newmat;
        Reset(newmat);
        VCEStatusBar.ShowText("New Material".ToLocalizationString() + " [" + newmat.m_Name + "]", 6f, true);
    }
Пример #13
0
 public static void DoDeleteFromMsgBox()
 {
     if (VCEAssetMgr.DeleteMaterial(s_CurrentDelMat.m_Guid))
     {
         VCEditor.SelectedMaterial = null;
         if (VCEditor.Instance.m_UI.m_MaterialWindow.WindowVisible())
         {
             VCEditor.Instance.m_UI.m_MaterialWindow.HideWindow();
         }
         VCEditor.Instance.m_UI.m_MaterialList.RefreshMaterialList(VCEditor.Instance.m_UI.m_MatterPopupList.selection);
         VCEStatusBar.ShowText("Material".ToLocalizationString() + " [" + s_CurrentDelMat.m_Name + "] " + "has been deleted".ToLocalizationString() + " !", 6f, true);
     }
     else
     {
         VCEMsgBox.Show(VCEMsgBoxType.MATERIAL_NOT_SAVED);
     }
 }
Пример #14
0
 public void OnBtnClick()
 {
     if (m_SceneSetting.m_Category == EVCCategory.cgAbstract)
     {
         return;
     }
     UICamera.selectedObject = null;
     notExpandTime           = 0;
     if (VCEHistory.s_Modified)
     {
         s_SceneToCreate = m_SceneSetting;
         VCEMsgBox.Show(VCEMsgBoxType.SWITCH_QUERY);
     }
     else
     {
         VCEditor.NewScene(m_SceneSetting);
     }
 }
Пример #15
0
    public void OnOKClick()
    {
        if (m_ErrorLabel.text.Trim().Length < 1 && m_TmpDecal != null && m_TmpDecal.m_Tex != null)
        {
            VCDecalAsset newdcl = new VCDecalAsset();
            newdcl.Import(m_TmpDecal.Export());
            VCEAssetMgr.s_Decals.Add(newdcl.m_Guid, newdcl);
            if (!VCEAssetMgr.CreateDecalDataFile(newdcl))
            {
                VCEMsgBox.Show(VCEMsgBoxType.DECAL_NOT_SAVED);
            }

            VCEditor.SelectedDecal = newdcl;
            VCEditor.Instance.m_UI.m_DecalList.RefreshDecalList();
            VCEditor.SelectedDecal = newdcl;

            VCEStatusBar.ShowText("Added new decal".ToLocalizationString() + " !", 4f, true);
        }
    }
Пример #16
0
    // load an iso
    public static void LoadIso(string path)
    {
        if (s_Instance == null)
        {
            return;
        }

        // Close current scene first
        CloseScene();

        // Load a VCEScene from an specified iso
        try
        {
            s_SceneId++;
            s_Scene = new VCEScene(path);

            // Build scene
            s_Scene.BuildScene();

            // After Scene Changed
            AfterSceneChanged(s_Scene.m_Setting);
        }
        catch (Exception)
        {
            NewScene(VCConfig.FirstSceneSetting);
            VCEMsgBox.Show(VCEMsgBoxType.CORRUPT_ISO);
            return;
        }

        if (OnSceneCreate != null)
        {
            OnSceneCreate(s_Scene);
        }

        Debug.Log("VCE load iso " + path + " sceneid = " + s_SceneId.ToString());
        // Show status
        VCEStatusBar.ShowText("Load".ToLocalizationString() + " ISO [" + path + "] " + "Complete".ToLocalizationString() + " !", 10, true);
    }
Пример #17
0
 void OnSelectDbClick()
 {
     if (m_IsFolder)
     {
         if (Directory.Exists(m_FilePath))
         {
             m_ParentList.m_Path = m_FilePath;
             m_ParentList.RefreshIsoList();
         }
         else
         {
             VCEStatusBar.ShowText("This folder does not exist".ToLocalizationString() + "!", 2f, false);
             m_ParentList.RefreshIsoList();
         }
     }
     else
     {
         if (File.Exists(m_FilePath))
         {
             if (VCEHistory.s_Modified)
             {
                 s_IsoToLoad = m_FilePath.Substring(VCConfig.s_IsoPath.Length);
                 VCEMsgBox.Show(VCEMsgBoxType.LOAD_QUERY);
             }
             else
             {
                 VCEditor.LoadIso(m_FilePath.Substring(VCConfig.s_IsoPath.Length));
             }
         }
         else
         {
             VCEMsgBox.Show(VCEMsgBoxType.MISSING_ISO);
             VCEStatusBar.ShowText("ISO file is missing".ToLocalizationString() + "!", 2f, false);
             m_ParentList.RefreshIsoList();
         }
     }
 }
Пример #18
0
    internal static void SendFile(SteamUploadEventHandler callBackSteamUploadResult, string name, string desc, byte[] preData, byte[] data, string[] tags, bool sendToServer = true, int id = -1, ulong fileId = 0, bool free = false)
    {
        ulong hash = CRC64.Compute(data);
        bool  ret  = false;

        try
        {
            if (string.IsNullOrEmpty(name))
            {
                VCEMsgBox.Show(VCEMsgBoxType.EXPORT_EMPTY_NAME);
                LogManager.Error("File name cannot be null.");
                return;
            }
            if (!SteamUser.BLoggedOn())
            {
                LogManager.Error("log back in steam...");
                return;
            }

            bool bPublish = !sendToServer;
            if (SteamRemoteStorage.FileExists(hash.ToString() + "_preview"))
            {            //file exist,don't publish it;
            }

            if (!SteamRemoteStorage.IsCloudEnabledForAccount())
            {
                throw new Exception("Account cloud disabled.");
            }

            if (!SteamRemoteStorage.IsCloudEnabledForApp())
            {
                throw new Exception("App cloud disabled.");
            }
            if (!bPublish)
            {
                SteamFileItem item = new SteamFileItem(callBackSteamUploadResult, name, desc, preData, data, hash, tags, bPublish, sendToServer, id, fileId, free);
                item.StartSend();
            }
            else
            {
                SendIsoCache iso = new SendIsoCache();
                iso.id           = id;
                iso.hash         = hash;
                iso.name         = name;
                iso.preData      = preData;
                iso.sendToServer = sendToServer;
                iso.tags         = tags;
                iso.data         = data;
                iso.desc         = desc;
                iso.callBackSteamUploadResult = callBackSteamUploadResult;
                iso.bPublish = bPublish;
                if (AddToIsoCache(iso))
                {
                    LobbyInterface.LobbyRPC(ELobbyMsgType.UploadISO, hash, SteamMgr.steamId.m_SteamID);
                }
                else
                {
                    return;
                }
            }

            VCEMsgBox.Show(VCEMsgBoxType.EXPORT_NETWORK);
            ret = true;
        }
        catch (Exception e)
        {
            VCEMsgBox.Show(VCEMsgBoxType.EXPORT_NETWORK_FAILED);
            Debug.LogWarning("workshop error :" + e.Message);
            ToolTipsMgr.ShowText(e.Message);
        }
        finally
        {
            if (!ret && callBackSteamUploadResult != null)
            {
                callBackSteamUploadResult(id, false, hash);
            }
        }
    }
Пример #19
0
 void OnDelClick()
 {
     s_IsoToDelete = m_FilePath;
     VCEMsgBox.Show(VCEMsgBoxType.DELETE_ISO);
 }
Пример #20
0
    /// <summary>
    /// Sends this creation to player (Create ItemObject).
    /// A creation can be send only once!
    /// </summary>
    public int SendToPlayer(out ItemObject item, bool pay = true)
    {
        // Check
        item = null;

        if (m_Attribute.m_Type == ECreation.Null)
        {
            return(0);
        }
        if (m_Prefab == null)
        {
            return(0);
        }

#if PLANET_EXPLORERS
        if (Pathea.PeCreature.Instance.mainPlayer == null)
        {
            return(0);
        }

        ItemProto itemProto = ItemProto.Mgr.Instance.Get(m_ObjectID);

        // Sending item to player.
        int retval = 1;
        if (!pay)
        {
            item = ItemMgr.Instance.CreateItem(m_ObjectID);
            return(retval);
        }
        Pathea.PlayerPackageCmpt pkg = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>();

        SlotList slotList = pkg.package.GetSlotList((ItemAsset.ItemPackage.ESlotType)itemProto.tabIndex);

        if (slotList.GetVacancyCount() > 0)
        {
            item = ItemMgr.Instance.CreateItem(m_ObjectID); // single
            if (slotList.Add(item, true))
            {
                if (!VCEditor.Instance.m_CheatWhenMakeCreation && !Pathea.PeGameMgr.IsSingleBuild)
                {
                    // Player must pay for it !
                    foreach (KeyValuePair <int, int> kvp in m_Attribute.m_Cost)
                    {
                        if (kvp.Value > 0)
                        {
                            pkg.package.Destroy(kvp.Key, kvp.Value);
                        }
                    }
                }
            }
        }
        else
        {
            VCEMsgBox.Show(VCEMsgBoxType.EXPORT_FULL);
            retval = -1;
        }
        // GUI Synchronization
        GameUI.Instance.mItemPackageCtrl.ResetItem();
#endif

        // Instance Data
        //m_Hp = m_Attribute.m_Durability;
        //m_Fuel = m_Attribute.m_MaxFuel;
        return(retval);
    }
Пример #21
0
 public void OnDelClick()
 {
     s_CurrentDelMat = m_Material;
     VCEMsgBox.Show(VCEMsgBoxType.MATERIAL_DEL_QUERY);
 }
Пример #22
0
    public static void DoSaveForOverwrite()
    {
        bool result = VCEditor.s_Scene.SaveIsoAs(s_SaveTargetForOverwrite);

        VCEMsgBox.Show(result ? VCEMsgBoxType.SAVE_OK : VCEMsgBoxType.SAVE_FAILED);
    }