コード例 #1
0
        private static CellContent DrawCellType(Rect rect, CellContent value)
        {
            // if clicked
            if ((Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag) &&
                rect.Contains(Event.current.mousePosition) && value.cellStruct.cellType != _cellTypePaint)
            {
                value.cellStruct.cellType = _cellTypePaint;
                GUI.changed = true;
                Event.current.Use();
            }

            UnityEditor.EditorGUI.DrawRect(rect.Padding(1), CellTypeToColor(value.cellStruct.cellType));

            return(value);
        }
コード例 #2
0
        protected override CellContent DrawElement(Rect rect, CellContent value)
        {
            EditorGUI.DrawRect(rect, Level.CellTypeToColor(value.cellStruct.cellType));

            if (value.unitData != null)
            {
                // Item count
                var countRect = rect.Padding(2).AlignBottom(16);
                EditorGUI.DrawRect(countRect, new Color(0.0f, 0.0f, 0.0f, 0.5f));
                GUI.Label(countRect, VEntityComponentSystemManager.GetVComponent <NameComponent>(value.unitData.entity).name, SirenixGUIStyles.CenteredGreyMiniLabel);
            }

            Texture texture = null;

            if (value.unitData != null && VEntityComponentSystemManager.HasVComponent <UnitDisplayComponent>(value.unitData.entity))
            {
                texture = GUIHelper.GetAssetThumbnail(VEntityComponentSystemManager.GetVComponent <UnitDisplayComponent>(value.unitData.entity).displaySprite, typeof(EntityScriptableObject), true);
            }

            value.unitData = (EntityScriptableObject)SirenixEditorFields.UnityPreviewObjectField(rect.Padding(16), value.unitData, texture, typeof(EntityScriptableObject));
            return(value);
        }
コード例 #3
0
 private void ClearTable()
 {
     levelData = new CellContent[height, width];
 }