Example #1
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();
     }
 }
Example #2
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();
    }
 public void OnDelClick()
 {
     s_CurrentDelDecal = VCEAssetMgr.GetDecal(m_GUID);
     if (s_CurrentDelDecal != null)
     {
         VCEMsgBox.Show(VCEMsgBoxType.DECAL_DEL_QUERY);
     }
 }
Example #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();
     }
 }
Example #5
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);
        }
    }
 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;
 }
    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);
        }
    }
 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;
 }
Example #9
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();
 }
Example #10
0
 public void OnQuitClick()
 {
     if (VCEditor.s_ProtectLock0)
     {
         return;
     }
     if (VCEHistory.s_Modified)
     {
         VCEMsgBox.Show(VCEMsgBoxType.CLOSE_QUERY);
     }
     else
     {
         VCEditor.Quit();
     }
 }
 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);
     }
 }
Example #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);
    }
 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);
     }
 }
Example #14
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);
        }
    }
Example #15
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);
    }
Example #16
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();
         }
     }
 }
Example #17
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);
            }
        }
    }
Example #18
0
 void OnDelClick()
 {
     s_IsoToDelete = m_FilePath;
     VCEMsgBox.Show(VCEMsgBoxType.DELETE_ISO);
 }
Example #19
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);
    }
 public void OnDelClick()
 {
     s_CurrentDelMat = m_Material;
     VCEMsgBox.Show(VCEMsgBoxType.MATERIAL_DEL_QUERY);
 }
Example #21
0
    public static void DoSaveForOverwrite()
    {
        bool result = VCEditor.s_Scene.SaveIsoAs(s_SaveTargetForOverwrite);

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