Show / Hide Table of Contents

Class DatabaseManager

The class to manage Database.
管理數據庫的類別。

Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
DatabaseManager
Namespace: Votanic.vNet.Database
Assembly: Votanic.vNet.dll
Syntax
[AddComponentMenu("")]
public class DatabaseManager : MonoBehaviour

Fields

account

Account input field.
帳戶輸入欄。

Declaration
[Header("[Inputs]")]
[Tooltip("Account input field.\n帳戶輸入欄。")]
public InputField account
Field Value
Type Description
UnityEngine.UI.InputField

appDetails

Details of this application.
應用程式詳述。

Declaration
[Tooltip("Details of this application.\n應用程式詳述。")]
public AppDetails appDetails
Field Value
Type Description
AppDetails

application

Path of application database.
應用程式數據庳的路徑。

Declaration
[Tooltip("Path of application database.\n應用程式數據庳的路徑。")]
public string application
Field Value
Type Description
System.String

autoGenID

Auto generate identifier if identifier is empty.
當識別碼為空時自動產生識別碼。

Declaration
[Tooltip("Auto generate identifier if identifier is empty.\n當識別碼為空時自動產生識別碼。")]
public bool autoGenID
Field Value
Type Description
System.Boolean

fileLocation

The relative folder location of files.
檔案的相對文件夾位置。

Declaration
[Header("[Settings]")]
[Tooltip("The relative folder location of files.\n檔案的相對文件夾位置。")]
public FileLocation fileLocation
Field Value
Type Description
FileLocation

infoPath

Path of json file which store the database information.
儲存數據庫資訊的 Json 文件路經。

Declaration
[Tooltip("Path of json file which store the database information.\n儲存數據庫資訊的 Json 文件路經")]
public string infoPath
Field Value
Type Description
System.String

isStarted

Return true if a session is started.
當一個場節開始時傳回 true。

Declaration
[Header("[Status]")]
[Tooltip("Return true if a session is started.\n當一個場節開始時傳回 true")]
public bool isStarted
Field Value
Type Description
System.Boolean

password

Password input field.
密碼輸入欄。

Declaration
[Tooltip("Password input field.\n密碼輸入欄。")]
public InputField password
Field Value
Type Description
UnityEngine.UI.InputField

smartID

Smart ID input field.
智能識別碼輸入欄。

Declaration
[Tooltip("Smart ID input field.\n智能識別碼輸入欄。")]
public InputField smartID
Field Value
Type Description
UnityEngine.UI.InputField

system

Path of system database.
系統數據庳的路徑。

Declaration
[Tooltip("Path of system database.\n系統數據庳的路徑。")]
public string system
Field Value
Type Description
System.String

tasks

List of task.
任務列表。

Declaration
[Tooltip("List of task.\n任務列表。")]
public List<TaskSetting> tasks
Field Value
Type Description
System.Collections.Generic.List<TaskSetting>

Properties

Database

The fully access authority handler for Database System.
數據庫系統的完全儲存權限處理器。

Declaration
public DatabaseHandler Database { get; }
Property Value
Type Description
DatabaseHandler

Methods

AddMetaInfo(String, Int32, String, String)

Add meta info for the current started session.
為目前已開始的場節新增元信息列表。

AddMetaInfo("Session", 1, "Week", "7")

Declaration
public void AddMetaInfo(string table, int refID, string key, string value)
Parameters
Type Name Description
System.String table

Related table name
相關表格名稱

System.Int32 refID

ID on related table
相關表格中的識別碼

System.String key

Attribute name
屬性名稱

System.String value

Contenr of attrubte
屬性內容

AddRecord(Player, Int32, String)

Add a record for a player.
為一個玩家新增一個記錄。

AddRecord(player[0], 1, "Done")

Declaration
public SessionDetail AddRecord(Player player, int task, string result)
Parameters
Type Name Description
Player player

Target player, player ID will be -1 if null
目標玩家,當空時將玩家識別碼視為 -1

System.Int32 task

Target task
目標任務

System.String result

Task result
任務結果

Returns
Type Description
SessionDetail

DeleteMetaInfos(MetaInfo[])

Delete metai infos on database.
刪除在數據庫中的元信息。

DeleteMetaInfos(sessionDetails)

Declaration
public void DeleteMetaInfos(params MetaInfo[] metaInfos)
Parameters
Type Name Description
MetaInfo[] metaInfos

Target metai infos
目標元信息

DeletePlayerSessions(PlayerSession[])

Delete player sessions on database.
刪除在數據庫中的玩家場節。

DeletePlayerSessions(playerSessions)

Declaration
public void DeletePlayerSessions(params PlayerSession[] playerSessions)
Parameters
Type Name Description
PlayerSession[] playerSessions

Target player sessions
目標玩家場節

DeleteSessionDetails(SessionDetail[])

Delete session details on database.
刪除在數據庫中的場節詳述。

DeleteSessionDetails(sessionDetails)

Declaration
public void DeleteSessionDetails(params SessionDetail[] sessionDetails)
Parameters
Type Name Description
SessionDetail[] sessionDetails

Target session details
目標場節詳述

DeleteSessions(Session[])

Delete sessions on database.
刪除在數據庫中的場節。

DeleteSessions(sessions)

Declaration
public void DeleteSessions(params Session[] sessions)
Parameters
Type Name Description
Session[] sessions

Target sessions
目標場節

EndSession(Boolean)

End the current session and save to database.
結束目前場節及儲存至數據庫。

EndSession(true)

Declaration
public void EndSession(bool save)
Parameters
Type Name Description
System.Boolean save

Save all records if true
當 true 時儲存所有記錄

GetCurrentDataTime()

Return the current data time with database format.
傳回以數據庫格式顯示的目前日期及時間。

Declaration
public string GetCurrentDataTime()
Returns
Type Description
System.String

GetCurrentPlayerSession(Int32)

Get current started player session.
取得目前開始的玩家場節。

GetCurrentPlayerSession(0)

Declaration
public PlayerSession GetCurrentPlayerSession(int playerID = -1)
Parameters
Type Name Description
System.Int32 playerID

Player ID
玩家識別碼

Returns
Type Description
PlayerSession

GetCurrentPlayerSessions()

Get all the current started player sessions.
取得目前開始的所有玩家場節。

Declaration
public List<PlayerSession> GetCurrentPlayerSessions()
Returns
Type Description
System.Collections.Generic.List<PlayerSession>

GetCurrentSession()

Get the current started session.
取得目前開始的場節。

Declaration
public Session GetCurrentSession()
Returns
Type Description
Session

GetCurrentSessionMetaInfo(String, Int32, String, String)

Get a neweset meta info from meta info list of current started session. Null and -1 parameter will be ignored.
在目前開始場節的元信息列表中取得一個最新的元信息。空及 -1 的參數將會無視。

GetCurrentSessionMetaInfo("Session", -1, "Week", "7")

Declaration
public MetaInfo GetCurrentSessionMetaInfo(string table = "", int refID = -1, string key = "", string value = "")
Parameters
Type Name Description
System.String table

Related table name
相關表格名稱

System.Int32 refID

ID on related table
相關表格中的識別碼

System.String key

Attribute name
屬性名稱

System.String value

Contenr of attrubte
屬性內容

Returns
Type Description
MetaInfo

GetCurrentUser()

Get the current login user.
取得目前登入的使用者。

Declaration
public User GetCurrentUser()
Returns
Type Description
User

GetMetaInfos(String, Int32, String, String)

Get meta info list of this application on database. Null and -1 parameter will be ignored.
取得應用程式在數據庫中的的元信息列表。空及 -1 的參數將會無視。

GetMetaInfos("Session", -1, "Week", "7")

Declaration
public List<MetaInfo> GetMetaInfos(string table = "", int refID = -1, string key = "", string value = "")
Parameters
Type Name Description
System.String table

Related table name
相關表格名稱

System.Int32 refID

ID on related table
相關表格中的識別碼

System.String key

Attribute name
屬性名稱

System.String value

Contenr of attrubte
屬性內容

Returns
Type Description
System.Collections.Generic.List<MetaInfo>

GetMetaInfos(SearchPattern[])

Get meta info list of this application on database.
取得應用程式在數據庫中的的元信息列表。

GetMetaInfos(new SearchPattern(MetaInfoKey.ID, Comparison.Equals, 1))

Declaration
public List<MetaInfo> GetMetaInfos(params SearchPattern[] searchPatterns)
Parameters
Type Name Description
SearchPattern[] searchPatterns

Search Pattern
搜索模式

Returns
Type Description
System.Collections.Generic.List<MetaInfo>

GetPlayerList()

Get the player list of current application from enrollment.
取得目前已登記應用程式的玩家列表。

Declaration
public List<Player> GetPlayerList()
Returns
Type Description
System.Collections.Generic.List<Player>

GetPlayerSessions(Int32)

Get player session list of current user on database. -1 parameter will be ignored.
取得目前使用者在數據庫中的玩家場節列表。-1 的參數將會無視。

GetPlayerSessions()

Declaration
public List<PlayerSession> GetPlayerSessions(int sessionID = -1)
Parameters
Type Name Description
System.Int32 sessionID

Session ID
場節識別碼

Returns
Type Description
System.Collections.Generic.List<PlayerSession>

GetPlayerSessions(Player, Int32)

Get player session list of a player on database. -1 parameter will be ignored.
取得一個玩家在數據庫中的玩家場節列表。-1 的參數將會無視。

GetPlayerSessions(player)

Declaration
public List<PlayerSession> GetPlayerSessions(Player player, int sessionID = -1)
Parameters
Type Name Description
Player player

Target player, player ID will be -1 if null
目標玩家,當空時將玩家識別碼視為 -1

System.Int32 sessionID

Session ID
場節識別碼

Returns
Type Description
System.Collections.Generic.List<PlayerSession>

GetPlayerSessions(SearchPattern[])

Get player sessions list of current user on database.
取得目前使用者在數據庫中的玩家場節列表。

GetPlayerSessions(new SearchPattern(PlayerSessionKey.PlayerID, Comparison.Equals, 1))

Declaration
public List<PlayerSession> GetPlayerSessions(params SearchPattern[] searchPatterns)
Parameters
Type Name Description
SearchPattern[] searchPatterns

Search Pattern
搜索模式

Returns
Type Description
System.Collections.Generic.List<PlayerSession>

GetRecord(Int32, String)

Get a neweset record from record list of current started session. Null and -1 parameter will be ignored.
在目前開始場節的記錄列表中取得一個最新記錄。空及 -1 的參數將會無視。

GetRecord()

Declaration
public SessionDetail GetRecord(int task = -1, string result = "")
Parameters
Type Name Description
System.Int32 task

Task ID
任務識別碼

System.String result

Task result
任務結果

Returns
Type Description
SessionDetail

GetRecord(Player, Int32, String)

Remove a neweset record from record list of current started session. Null and -1 parameter will be ignored.
在目前開始場節的記錄列表中取得一個最新記錄。空及 -1 的參數將會無視。

GetRecord(player)

Declaration
public SessionDetail GetRecord(Player player, int task = -1, string result = "")
Parameters
Type Name Description
Player player

Target player, player ID will be -1 if null
目標玩家,當空時將玩家識別碼視為 -1

System.Int32 task

Task ID
任務識別碼

System.String result

Task result
任務結果

Returns
Type Description
SessionDetail

GetSessionDetails(Int32, String, String)

Get session detail list of current user on database. Null and -1 parameter will be ignored.
取得目前使用者在數據庫中的場節詳述列表。空及 -1 的參數將會無視。

GetSessionDetails()

Declaration
public List<SessionDetail> GetSessionDetails(int taskID = -1, string taskResult = "", string timestamp = "")
Parameters
Type Name Description
System.Int32 taskID

Task ID
任務識別碼

System.String taskResult

Task result
任務結果

System.String timestamp

The date time when the task is recorded
任務被記錄的日期時間

Returns
Type Description
System.Collections.Generic.List<SessionDetail>

GetSessionDetails(Player, Int32, String, String)

Get session detail list of a player on database. Null and -1 parameter will be ignored.
取得一個玩家在數據庫中的場節詳述列表。空及 -1 的參數將會無視。

GetSessionDetails(player)

Declaration
public List<SessionDetail> GetSessionDetails(Player player, int taskID = -1, string taskResult = "", string timestamp = "")
Parameters
Type Name Description
Player player

Target player, player ID will be -1 if null
目標玩家,當空時將玩家識別碼視為 -1

System.Int32 taskID

Task ID
任務識別碼

System.String taskResult

Task result
任務結果

System.String timestamp

The date time when the task is recorded
任務被記錄的日期時間

Returns
Type Description
System.Collections.Generic.List<SessionDetail>

GetSessionDetails(SearchPattern[])

Get session detail list of current user on database.
取得目前使用者在數據庫中的場節詳述列表。

GetSessionDetails(new SearchPattern(SessionDetailKey.ID, Comparison.Equals, 1))

Declaration
public List<SessionDetail> GetSessionDetails(params SearchPattern[] searchPatterns)
Parameters
Type Name Description
SearchPattern[] searchPatterns

Search Pattern
搜索模式

Returns
Type Description
System.Collections.Generic.List<SessionDetail>

GetSessions(String, String)

Get all sessions of current user on database. Null parameter will be ignored.
取得目前使用者在數據庫中的所有場節。空的參數將會無視。

GetSessions()

Declaration
public List<Session> GetSessions(string start = "", string end = "")
Parameters
Type Name Description
System.String start

Start date time
開始日期及時間

System.String end

End date time
結束日期及時間

Returns
Type Description
System.Collections.Generic.List<Session>

GetSessions(SearchPattern[])

Get session list of current user on database.
取得目前使用者在數據庫中的場節列表。

GetSessions(new SearchPattern(SessionKey.ID, Comparison.Equals, 1))

Declaration
public List<Session> GetSessions(params SearchPattern[] searchPatterns)
Parameters
Type Name Description
SearchPattern[] searchPatterns

Search Pattern
搜索模式

Returns
Type Description
System.Collections.Generic.List<Session>

IsValidPlayer()

Return a player true if the input field typed a valid player data.
當輸入欄的資料為有效玩家的數據時傳回一個玩家。

Declaration
public Player IsValidPlayer()
Returns
Type Description
Player

IsValidPlayer(String)

Return a player true if the smart ID of player is valid.
當玩家的智能識碼為有效時傳回一個玩家。

IsValidPlayer("12345678")

Declaration
public Player IsValidPlayer(string smartID)
Parameters
Type Name Description
System.String smartID

Smart ID of player
玩家的智能識別碼

Returns
Type Description
Player

IsValidPlayer(String, String)

Return a player if the account and passowrd of player is valid.
當玩家的帳戶及密碼為有效時傳回一個玩家。

IsValidPlayer("AC1234", "********")

Declaration
public Player IsValidPlayer(string account, string password)
Parameters
Type Name Description
System.String account

Account of player
玩家的帳戶

System.String password

Password of player
玩家的密碼

Returns
Type Description
Player

RemoveMetaInfo(MetaInfo)

Remove the newest meta info of current started session.
目前已開始的場節移除最新的元信息。

RemoveMetaInfo(metaInfo)

Declaration
public void RemoveMetaInfo(MetaInfo metaInfo)
Parameters
Type Name Description
MetaInfo metaInfo

Target meta info
目標元信息

RemoveRecord(SessionDetail)

Remove a record from record list.
在記錄列表中移除一個記錄。

RemoveRecord(sessionDetail)

Declaration
public void RemoveRecord(SessionDetail sessionDetail)
Parameters
Type Name Description
SessionDetail sessionDetail

Target record
目標記錄

StartSession(List<Player>)

Start a new session.
開始新場節。

StartSession(players)

Declaration
public void StartSession(List<Player> players)
Parameters
Type Name Description
System.Collections.Generic.List<Player> players

Participating players
參與玩家

In This Article
Back to top Generated by DocFX