-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathExcelMachine.cs
More file actions
63 lines (56 loc) · 1.99 KB
/
ExcelMachine.cs
File metadata and controls
63 lines (56 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
///////////////////////////////////////////////////////////////////////////////
///
/// ExcelMachine.cs
///
/// (c)2014 Kim, Hyoun Woo
///
///////////////////////////////////////////////////////////////////////////////
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace UnityQuickSheet
{
/// <summary>
/// A class for various setting to read excel file and generated related script files.
/// </summary>
internal class ExcelMachine : BaseMachine
{
/// <summary>
/// where the .xls or .xlsx file is. The path should start with "Assets/".
/// </summary>
public string excelFilePath;
// both are needed for popup editor control.
public string[] SheetNames = { "" };
public int CurrentSheetIndex
{
get { return currentSelectedSheet; }
set { currentSelectedSheet = value;}
}
[SerializeField]
protected int currentSelectedSheet = 0;
/// <summary>
/// Note: Called when the asset file is created.
/// </summary>
private void Awake() {
if (ExcelSettings.Instance != null)
{
// excel and google plugin have its own template files,
// so we need to set the different path when the asset file is created.
TemplatePath = ExcelSettings.Instance.TemplatePath;
}
}
/// <summary>
/// A menu item which create a 'ExcelMachine' asset file.
/// </summary>
[MenuItem("Assets/Create/QuickSheet/Tools/Excel")]
public static ExcelMachine CreateScriptMachineAsset()
{
ExcelMachine inst = ScriptableObject.CreateInstance<ExcelMachine>();
string path = CustomAssetUtility.GetUniqueAssetPathNameOrFallback(ImportSettingFilename);
AssetDatabase.CreateAsset(inst, path);
AssetDatabase.SaveAssets();
Selection.activeObject = inst;
return inst;
}
}
}