Gameplay Ingredients是一组用于 Unity 游戏的运行时和编辑器工具:一组脚本的集合,可在制作游戏和原型时简化简单的任务。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

130 行
3.0 KiB

using NaughtyAttributes;
using System;
using System.Linq;
using UnityEngine;
namespace GameplayIngredients.Comments
{
[Serializable]
public struct Comment
{
#if UNITY_EDITOR
const string kUserPreference = "GameplayIngredients.Comments.User";
public static string currentUser => UnityEditor.EditorPrefs.GetString(kUserPreference, "user");
#endif
public string title;
public CommentMessage message;
public CommentMessage[] replies;
public bool focus;
public string[] users
{
get
{
var users = replies.Select(r => r.from).ToList();
users.Add(message.from);
return users.ToArray();
}
}
public CommentType computedType
{
get
{
CommentType currentType = message.type;
if(replies != null)
{
foreach (var reply in replies)
{
if (reply.changeType)
currentType = reply.type;
}
}
return currentType;
}
}
public CommentState computedState
{
get
{
CommentState currentState = message.state;
if (replies != null)
{
foreach (var reply in replies)
{
if (reply.changeState)
currentState = reply.state;
}
}
return currentState;
}
}
public CommentPriority computedPriority
{
get
{
CommentPriority currentPriority = message.priority;
if (replies != null)
{
foreach (var reply in replies)
{
if (reply.changePriority)
currentPriority = reply.priority;
}
}
return currentPriority;
}
}
}
[Serializable]
public struct CommentMessage
{
public string from;
public string URL;
[Multiline]
public string body;
[ReorderableList, NoLabel]
public UnityEngine.Object[] attachedObjects;
public bool changeType;
public bool changeState;
public bool changePriority;
public CommentType type;
public CommentState state;
public CommentPriority priority;
}
[Serializable]
public enum CommentType
{
Info,
Bug,
Request,
ToDo,
}
[Serializable]
public enum CommentState
{
Open,
Blocked,
Resolved,
WontFix,
Closed,
}
[Serializable]
public enum CommentPriority
{
High,
Medium,
Low,
}
}