774d18a99d
made most of the game Moddable. There is an in editor tool to make the mods and set them all up, and im making an external tool that will show your mods, lets you edit any information and it will pack it up and upload it. currently working on the uploading. Next I will make the game able to download and install. - Fuck Nexus.
125 lines
4.0 KiB
C#
125 lines
4.0 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEditor;
|
|
using UnityEngine.AddressableAssets;
|
|
|
|
|
|
public class ModUploader : EditorWindow
|
|
{
|
|
private string ModName = "";
|
|
private string Author = "";
|
|
private string Description = "";
|
|
public Sprite MyImage;
|
|
private string Version = "1.0";
|
|
private string Category = "Armor";
|
|
|
|
private string path = "";
|
|
|
|
|
|
[MenuItem("Schaken-Mods/Mod Uploader/Open Window")]
|
|
|
|
private static void OpenWindow() {
|
|
ModUploader window = GetWindow<ModUploader>();
|
|
|
|
// Set Title
|
|
Texture2D icon = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Editor/Mod Builder/ModBuilder.png", typeof(Texture2D));
|
|
|
|
GUIContent titleContent = new GUIContent("Mod Uploader", icon);
|
|
window.titleContent = titleContent;
|
|
window.minSize = new Vector2(340, 410);
|
|
window.maxSize = new Vector2(340, 410);
|
|
|
|
window.Show();
|
|
}
|
|
|
|
private void OnGUI() {
|
|
EditorGUIUtility.labelWidth = 45;
|
|
EditorGUILayout.Space(10);
|
|
|
|
EditorGUILayout.BeginVertical("box");
|
|
|
|
EditorGUILayout.BeginHorizontal();
|
|
if (GUILayout.Button("Selected a Mod")) {
|
|
string ModFolders = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)+@"\My Games\Firstborn\Mods\";
|
|
path = EditorUtility.OpenFilePanel("Select a mod file", ModFolders, "fc1");
|
|
}
|
|
if (path.Length != 0) {
|
|
using (var sr = new StreamReader(path)) {
|
|
string A = sr.ReadToEnd();
|
|
Debug.Log(path);
|
|
Debug.Log(A);
|
|
|
|
|
|
string TempString = "/Firstborn/Mods/";
|
|
ModName = path.Split(TempString)[1].Split("/")[0];
|
|
TempString = "Author:";
|
|
Author = A.Split(TempString)[1].Split(";")[0];
|
|
TempString = "Description:";
|
|
Description = A.Split(TempString)[1].Split(";")[0];
|
|
TempString = "Author:";
|
|
//MyImage = A.Split(TempString)[1].Split(";")[0];
|
|
TempString = "Version:";
|
|
Version = A.Split(TempString)[1].Split(";")[0];
|
|
TempString = "Category:";
|
|
Category = A.Split(TempString)[1].Split(";")[0];
|
|
|
|
|
|
Debug.Log(sr);
|
|
}
|
|
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUILayout.LabelField("Mod Name: ", GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
ModName = GUILayout.TextField(ModName, 25, GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUILayout.LabelField("Version: ", GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
Version = GUILayout.TextField(Version, GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUILayout.LabelField("Author: ", GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
Author = GUILayout.TextField(Author, 25, GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUILayout.LabelField("Short Description: ", GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
Description = GUILayout.TextArea(Description, GUILayout.Height(100), GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUILayout.LabelField("Preview Picture: ", GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
MyImage = (Sprite)EditorGUILayout.ObjectField(MyImage, typeof(Sprite), false, GUILayout.Height(EditorGUIUtility.singleLineHeight), GUILayout.MaxWidth(160), GUILayout.MinWidth(160));
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
EditorGUILayout.BeginHorizontal();
|
|
Sprite s = (MyImage) ? MyImage as Sprite : (Sprite)AssetDatabase.LoadAssetAtPath("Assets/Textures/UI/Background.png", typeof(Sprite));
|
|
EditorGUI.DrawTextureTransparent(new Rect(17, 225, 300, 160), s.texture);
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
EditorGUILayout.Space(165);
|
|
|
|
EditorGUILayout.BeginHorizontal();
|
|
if (GUILayout.Button("Build Mod", GUILayout.MaxWidth(320), GUILayout.MinWidth(320))) {
|
|
}
|
|
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
EditorGUILayout.EndVertical();
|
|
|
|
}
|
|
|
|
private void SetCategory(string A) {
|
|
Category = A;
|
|
}
|
|
|
|
}
|
|
|