Skip to content

Commit

Permalink
Add build pipeline for linux, change parsing of list object
Browse files Browse the repository at this point in the history
  • Loading branch information
qhdwight committed Apr 19, 2022
1 parent 4a56a13 commit 26c9872
Show file tree
Hide file tree
Showing 25 changed files with 593 additions and 479 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Resources/Config.asset
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ MonoBehaviour:
m_Value: 0
authenticateSteam:
m_Flags: 1
m_Value: 1
m_Value: 0
secureAreaConfig:
roundEndDurationUs:
m_Flags: 1
Expand Down
22 changes: 11 additions & 11 deletions Assets/Scenes/Base.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1571494958}
m_HandleRect: {fileID: 1571494957}
m_Direction: 2
m_Value: 1
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
Expand Down Expand Up @@ -10091,7 +10091,7 @@ MonoBehaviour:
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_MatchWidthOrHeight: 0.6
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
Expand Down Expand Up @@ -12720,7 +12720,7 @@ MonoBehaviour:
m_HideMobileInput: 0
m_HideSoftKeyboard: 0
m_CharacterValidation: 6
m_RegexValue: ^[\w \.:&;]+$
m_RegexValue: ^[\w \.:&;,]+$
m_GlobalPointSize: 14
m_CharacterLimit: 0
m_OnEndEdit:
Expand Down Expand Up @@ -18539,7 +18539,7 @@ MonoBehaviour:
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_MatchWidthOrHeight: 0.6
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
Expand Down Expand Up @@ -19942,7 +19942,7 @@ MonoBehaviour:
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_MatchWidthOrHeight: 0.6
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
Expand Down Expand Up @@ -24095,7 +24095,7 @@ PrefabInstance:
- target: {fileID: 7936714082184610991, guid: ec2d5468a4c30524d85166d333868ddd,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7936714082184610991, guid: ec2d5468a4c30524d85166d333868ddd,
type: 3}
Expand All @@ -24105,27 +24105,27 @@ PrefabInstance:
- target: {fileID: 7936714082184610991, guid: ec2d5468a4c30524d85166d333868ddd,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7936714082184610991, guid: ec2d5468a4c30524d85166d333868ddd,
type: 3}
propertyPath: m_SizeDelta.x
value: 271.45248
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7936714082184610991, guid: ec2d5468a4c30524d85166d333868ddd,
type: 3}
propertyPath: m_SizeDelta.y
value: 40
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7936714082184610991, guid: ec2d5468a4c30524d85166d333868ddd,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 135.72624
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7936714082184610991, guid: ec2d5468a4c30524d85166d333868ddd,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -20
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ec2d5468a4c30524d85166d333868ddd, type: 3}
Expand Down
7 changes: 6 additions & 1 deletion Assets/Scripts/Voxelfield/Session/SessionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ public static void BuildWindowsIl2CppServer()
public static void BuildLinuxMonoServer()
=> Build(ScriptingImplementation.Mono2x, BuildTarget.StandaloneLinux64, "Debug Linux Mono Server", true);

[MenuItem("Build/Linux IL2CPP Player", priority = 100)]
public static void BuildLinuxIl2CppPlayer()
=> Build(ScriptingImplementation.IL2CPP, BuildTarget.StandaloneLinux64, "Debug Linux IL2CPP Player");

// [MenuItem("Build/Release Windows Player")]
// private static void BuildWindowsRelease()
// => Build(ScriptingImplementation.Mono2x, BuildTarget.StandaloneWindows64, "Release Windows Mono Player", defines: new[] {"VOXELFIELD_RELEASE_CLIENT"});
Expand Down Expand Up @@ -451,7 +455,8 @@ private static void Build(ScriptingImplementation scripting, BuildTarget target,
{
scenes = new[] { "Assets/Scenes/Base.unity" },
locationPathName = executablePath,
target = target
target = target,
options = BuildOptions.CompressWithLz4
};
EditorUserBuildSettings.standaloneBuildSubtarget = isServer ? StandaloneBuildSubtarget.Server : StandaloneBuildSubtarget.Player;
if (defines != null) buildPlayerOptions.extraScriptingDefines = defines;
Expand Down
4 changes: 2 additions & 2 deletions LiteNetLib.csproj.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=packages/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=packages_005Clitenetlib/@EntryIndexedValue">True</s:Boolean>

<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=packages_005Clitenetlib/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=packages_005Clitenetlib_005Cruntime/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
8 changes: 5 additions & 3 deletions Packages/Swihoni.Components/Runtime/ListProperty.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using LiteNetLib.Utils;
using UnityEngine;

Expand Down Expand Up @@ -71,7 +72,7 @@ public bool TryRemoveEnd(out TElement element)
[Serializable]
public class ListProperty<TElement> : ListPropertyBase<TElement> where TElement : ElementBase
{
private const string Separator = ";";
private const string Separator = ", ";

public ListProperty() { }
public ListProperty(int maxSize) : base(maxSize) { }
Expand Down Expand Up @@ -111,8 +112,9 @@ public override StringBuilder AppendValue(StringBuilder builder)
var afterFirst = false;
foreach (TElement element in m_List)
{
if (afterFirst) builder.Append(Separator).Append(" ");
if (afterFirst) builder.Append(Separator);
builder.Stringify(element);
// builder.Append(new StringBuilder().Stringify(element).ToString().Replace(Separator, $"\\{Separator}"));
afterFirst = true;
}
return builder;
Expand All @@ -121,7 +123,7 @@ public override StringBuilder AppendValue(StringBuilder builder)
public override void ParseValue(string stringValue)
{
Zero();
string[] elementStrings = stringValue.Split(new[] {Separator}, StringSplitOptions.RemoveEmptyEntries);
string[] elementStrings = stringValue.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries);
foreach (string elementString in elementStrings)
{
var element = ComponentExtensions.NewElement<TElement>();
Expand Down
21 changes: 10 additions & 11 deletions Packages/Swihoni.Components/Runtime/PropertyBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ public abstract class PropertyBase : ElementBase
{
[SerializeField] private ElementFlags m_Flags = ElementFlags.None;

public byte RawFlags
{
get => (byte) m_Flags;
set => m_Flags = (ElementFlags) value;
}
public byte RawFlags { get => (byte)m_Flags; set => m_Flags = (ElementFlags)value; }

public bool WithValue
{
Expand Down Expand Up @@ -80,7 +76,7 @@ public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ (int) m_Flags;
return (base.GetHashCode() * 397) ^ (int)m_Flags;
}
}

Expand Down Expand Up @@ -118,6 +114,8 @@ public virtual bool TryParseValue(string propertyString)
}
}

public virtual string GetParseFormat() => null;

public virtual void Clear() => WithValue = false;

public virtual void SetFromIfWith(PropertyBase other)
Expand All @@ -144,10 +142,11 @@ public class BoxedEnumProperty<TEnum> : PropertyBase<TEnum> where TEnum : struct
public BoxedEnumProperty() { }
public BoxedEnumProperty(TEnum value) : base(value) { }
public override bool ValueEquals(in TEnum value) => Equals(Value, value);
public override void SerializeValue(NetDataWriter writer) => writer.Put((int) (object) Value);
public override void DeserializeValue(NetDataReader reader) => Value = (TEnum) (object) reader.GetInt();
public override void SerializeValue(NetDataWriter writer) => writer.Put((int)(object)Value);
public override void DeserializeValue(NetDataReader reader) => Value = (TEnum)(object)reader.GetInt();
public override StringBuilder AppendValue(StringBuilder builder) => builder.Append(Names.GetForward(Value));
public override void ParseValue(string stringValue) => Value = Names.GetReverse(stringValue);
public override string GetParseFormat() => string.Join(", ", Names.Backwards);
}

/// <summary>
Expand Down Expand Up @@ -200,7 +199,7 @@ public T ValueOverride

public ref T DirectValue => ref m_Value;

public T? AsNullable => WithValue ? m_Value : (T?) null;
public T? AsNullable => WithValue ? m_Value : null;

protected PropertyBase() { }

Expand All @@ -215,7 +214,7 @@ public override int GetHashCode()
}
}

public override bool Equals(object other) => this == (PropertyBase<T>) other;
public override bool Equals(object other) => this == (PropertyBase<T>)other;

public static implicit operator T(PropertyBase<T> property) => property.Value;

Expand Down Expand Up @@ -261,7 +260,7 @@ public PropertyBase<T> If(Action<T> action)
public T Else(T @default = default) => WithValue ? m_Value : @default;

/// <returns>False if types are different. Equal if both values are the same, or if both do not have values.</returns>
public sealed override bool Equals(PropertyBase other) => this == (PropertyBase<T>) other;
public sealed override bool Equals(PropertyBase other) => this == (PropertyBase<T>)other;

/// <summary>Use on two properties that are known to have values.</summary>
/// <returns>False if types are different. Equal if both values are the same.</returns>
Expand Down
12 changes: 6 additions & 6 deletions Packages/Swihoni.Components/Runtime/StringProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ private void ThrowIfOverMaxSize(int size)

public override void Serialize(NetDataWriter writer)
{
if (m_MaxSize <= byte.MaxValue) writer.Put((byte) Builder.Length);
else writer.Put((ushort) Builder.Length);
if (m_MaxSize <= byte.MaxValue) writer.Put((byte)Builder.Length);
else writer.Put((ushort)Builder.Length);
for (var i = 0; i < Builder.Length; i++) writer.Put(Builder[i]);
}

Expand All @@ -82,17 +82,17 @@ public override int GetHashCode()

public bool Equals(string @string) => this == @string;

public override bool Equals(object other) => this == (StringProperty) other;
public override bool Equals(object other) => this == (StringProperty)other;

public override bool Equals(PropertyBase other) => this == (StringProperty) other;
public override bool Equals(PropertyBase other) => this == (StringProperty)other;

public static bool operator ==(StringProperty s1, string s2) => s1.Builder.ToString() == s2;
public static bool operator ==(StringProperty s1, string s2) => s1!.Builder.ToString() == s2;

public static bool operator !=(StringProperty s1, string s2) => !(s1 == s2);

public static bool operator ==(StringProperty s1, StringProperty s2)
{
if (s1.Builder.Length != s2.Builder.Length) return false;
if (s1!.Builder.Length != s2!.Builder.Length) return false;
for (var i = 0; i < s1.Builder.Length; i++)
if (s1.Builder[i] != s2.Builder[i])
return false;
Expand Down
Loading

0 comments on commit 26c9872

Please sign in to comment.