Skip to content

Commit 5e530a6

Browse files
committed
Initial commit
0 parents  commit 5e530a6

26 files changed

+497
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*.cs]
7+
charset = utf-8
8+
indent_style = space
9+
indent_size = 4
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/FUNDING.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: "https://www.paypal.me/litefeel"

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/[Ll]ibrary/
2+
/[Tt]emp/
3+
/[Oo]bj/
4+
/[Bb]uild/
5+
/[Bb]uilds/
6+
/Assets/AssetStoreTools*
7+
8+
# Autogenerated VS/MD solution and project files
9+
ExportedObj/
10+
*.csproj
11+
*.unityproj
12+
*.sln
13+
*.suo
14+
*.tmp
15+
*.user
16+
*.userprefs
17+
*.pidb
18+
*.booproj
19+
*.svd
20+
.vs
21+
22+
# Unity3D generated meta files
23+
*.pidb.meta
24+
25+
# Unity3D Generated File On Crash Reports
26+
sysinfo.txt
27+
28+
# Unity3D AssetStoreTools
29+
Assets/AssetStoreTools

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#### v1.0.0 - 2020-02-27
2+
- initial version

CHANGELOG.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/PreferencesGUI.cs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using UnityEditor;
5+
using UnityEngine;
6+
using UnityScript.Lang;
7+
8+
9+
namespace litefeel.LuaInteractive.Editor
10+
{
11+
public static class PreferencesGUI
12+
{
13+
#if UNITY_2018_3_OR_NEWER
14+
private class MyPrefSettingsProvider : SettingsProvider
15+
{
16+
public MyPrefSettingsProvider(string path, SettingsScope scopes = SettingsScope.User)
17+
: base(path, scopes)
18+
{ }
19+
20+
public override void OnGUI(string searchContext)
21+
{
22+
PreferencesGUI.OnGUI();
23+
}
24+
}
25+
26+
[SettingsProvider]
27+
static SettingsProvider NewPreferenceItem()
28+
{
29+
return new MyPrefSettingsProvider("Preferences/Lua Interactive");
30+
}
31+
#else
32+
[PreferenceItem("Lua Interactive")]
33+
#endif
34+
public static void OnGUI()
35+
{
36+
Settings.AutoClearLog = EditorGUILayout.ToggleLeft("Auto Clear Log", Settings.AutoClearLog);
37+
Settings.LuaPath = EditorGUILayout.TextField("Lua Script File", Settings.LuaPath);
38+
using(new EditorGUI.DisabledScope(string.IsNullOrEmpty(Settings.LuaPath)))
39+
{
40+
if (GUILayout.Button("Create defualt lua script"))
41+
CreateDefaultScript();
42+
}
43+
}
44+
45+
private static void CreateDefaultScript()
46+
{
47+
var path = Settings.LuaPath;
48+
if (string.IsNullOrEmpty(path)) return;
49+
50+
if (File.Exists(path))
51+
{
52+
if(!EditorUtility.DisplayDialog("Save File",
53+
$"the file already exists, do you want to overwrite it?\n{path}",
54+
"Overwrite", "Cancel"))
55+
{
56+
return;
57+
}
58+
}
59+
60+
var srcfile = "Packages/com.litefeel.luainteractive/Editor/defaultlua.lua";
61+
File.Copy(srcfile, path, true);
62+
}
63+
}
64+
}

Editor/PreferencesGUI.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/Settings.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
4+
namespace litefeel.LuaInteractive.Editor
5+
{
6+
public static class Settings
7+
{
8+
private const string AutoClearLogKey = "litefeel.LuaInteractive.AutoClearLog";
9+
private const string LuaPathKey = "litefeel.LuaInteractive.LuaPath";
10+
11+
12+
[InitializeOnLoadMethod]
13+
private static void Init()
14+
{
15+
_AutoClearLog = EditorPrefs.GetBool(AutoClearLogKey, false);
16+
LuaPath = EditorPrefs.GetString(LuaPathKey, "");
17+
}
18+
19+
private static bool _AutoClearLog;
20+
public static bool AutoClearLog
21+
{
22+
get { return _AutoClearLog; }
23+
set
24+
{
25+
if (value != _AutoClearLog)
26+
{
27+
_AutoClearLog = value;
28+
EditorPrefs.SetBool(AutoClearLogKey, value);
29+
}
30+
}
31+
}
32+
33+
private static string _LuaPath;
34+
public static string LuaPath
35+
{
36+
get { return _LuaPath; }
37+
set
38+
{
39+
if (value != _LuaPath)
40+
{
41+
_LuaPath = value;
42+
EditorPrefs.SetString(LuaPathKey, value);
43+
}
44+
}
45+
}
46+
}
47+
}
48+
49+

0 commit comments

Comments
 (0)