Compare commits

...

5 Commits

Author SHA1 Message Date
b7653bdd05 feat: added some nice beats :D 2024-04-22 13:37:18 +02:00
134c6f8923 fix: normal logging when using webgl in editor 2024-04-22 13:35:46 +02:00
4610120329 fix: match logic for rounds, hide HUD when in menu 2024-04-22 13:34:37 +02:00
a3fa41eae2 fix: instead of using the log4uni wrapper, I wrote my own
This wrapper essentially restricts the logger to the unity console, when using WebGL, while I don't need to change any Reference to LogManager or Log.Debug(etc) in my code.
2024-04-20 16:26:28 +02:00
969b0df42b Revert "fix: changing to log4uni, because of log4net issues in build versions"
This reverts commit ef425d0ea5.
2024-04-20 15:14:33 +02:00
50 changed files with 818 additions and 731 deletions

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: d1ec1eae9a033cd4c93bf12719fcc6da
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 63665211bd1fd94498c07fd68e2e85a2
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: e64df9eb72ad48d47a43a5d0812ca086
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 3e4c244b1b1897a46b261795706dc7c0
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: f075ab744dfba084690dc1039550d2e9
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -13,12 +13,6 @@
value=" %message | %logger | Thread: [%thread] %date{ss:fff}ms %newline" />
</layout>
</appender>
<appender name="unityConsole" type="log4net.Unity.UnityDefaultLogAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%thread][%level][%logger] %message"/>
</layout>
</appender>
<!-- Rolling file appender -->
<appender name="File" type="log4net.Appender.RollingFileAppender">

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 46804775b56e0324cb026fee279425ee
guid: 7c1001ab95d71c345aac765158c01a9f
TextScriptImporter:
externalObjects: {}
userData:

View File

@ -0,0 +1,312 @@
using System;
using System.IO;
using log4net;
using log4net.Config;
using log4net.Core;
using UnityEngine;
/// <summary>
/// Wraps Log4Net to only be used when not bein in a WebGL environment.
/// When the game runs in WebGL, only the default console logs are used.
/// </summary>
public static class LogManager
{
public static Level GlobalLogLevel = Level.Debug;
public static log4net.ILog GetLogger(Type type)
{
#if !UNITY_WEBGL || UNITY_EDITOR
return log4net.LogManager.GetLogger(type);
#else
return new ConsoleLogger();
#endif
}
public static void ConfigureLogging()
{
#if !UNITY_WEBGL || UNITY_EDITOR
log4net.GlobalContext.Properties["LogFileName"] = $"{Application.dataPath}" +
"\\Logging\\SSOLog";
var fi = new FileInfo($"{Application.dataPath}" +
"\\Logging\\Log4NetConfiguration.xml");
XmlConfigurator.Configure(fi);
#else
UnityEngine.Debug.Log("When using WebGL, logging is restricted to the console and unity's built in logger.");
#endif
}
}
/// <summary>
/// Logger which has the ILog interface, but only prints to Unity Console.
/// </summary>
public class ConsoleLogger : log4net.ILog
{
public bool IsDebugEnabled
{
get
{
return LogManager.GlobalLogLevel >= Level.Debug;
}
}
public bool IsInfoEnabled
{
get
{
return LogManager.GlobalLogLevel >= Level.Info;
}
}
public bool IsWarnEnabled
{
get
{
return LogManager.GlobalLogLevel >= Level.Warn;
}
}
public bool IsErrorEnabled
{
get
{
return LogManager.GlobalLogLevel >= Level.Error;
}
}
public bool IsFatalEnabled
{
get
{
return LogManager.GlobalLogLevel >= Level.Error;
}
}
log4net.Core.ILogger ILoggerWrapper.Logger => throw new NotImplementedException();
/* Log a message object */
public void Debug(object message)
{
if (IsDebugEnabled)
UnityEngine.Debug.Log(message);
}
public void Info(object message)
{
if (IsInfoEnabled)
UnityEngine.Debug.Log(message);
}
public void Warn(object message)
{
if (IsWarnEnabled)
UnityEngine.Debug.LogWarning(message);
}
public void Error(object message)
{
if (IsErrorEnabled)
UnityEngine.Debug.LogError(message);
}
public void Fatal(object message)
{
if (IsFatalEnabled)
UnityEngine.Debug.LogError(message);
}
/* Log a message object and exception */
public void Debug(object message, Exception t)
{
if (IsDebugEnabled)
UnityEngine.Debug.Log(string.Format("{0}\n{1}: {2}\n{3}", message, t.GetType().ToString(), t.Message, t.StackTrace));
}
public void Info(object message, Exception t)
{
if (IsInfoEnabled)
UnityEngine.Debug.Log(string.Format("{0}\n{1}: {2}\n{3}", message, t.GetType().ToString(), t.Message, t.StackTrace));
}
public void Warn(object message, Exception t)
{
if (IsWarnEnabled)
UnityEngine.Debug.LogWarning(string.Format("{0}\n{1}: {2}\n{3}", message, t.GetType().ToString(), t.Message, t.StackTrace));
}
public void Error(object message, Exception t)
{
if (IsErrorEnabled)
UnityEngine.Debug.LogError(string.Format("{0}\n{1}: {2}\n{3}", message, t.GetType().ToString(), t.Message, t.StackTrace));
}
public void Fatal(object message, Exception t)
{
if (IsFatalEnabled)
UnityEngine.Debug.LogError(string.Format("{0}\n{1}: {2}\n{3}", message, t.GetType().ToString(), t.Message, t.StackTrace));
}
/* Log a message string using the System.String.Format syntax */
public void DebugFormat(string format, params object[] args)
{
if (IsDebugEnabled)
UnityEngine.Debug.Log(string.Format(format, args));
}
public void InfoFormat(string format, params object[] args)
{
if (IsInfoEnabled)
UnityEngine.Debug.Log(string.Format(format, args));
}
public void WarnFormat(string format, params object[] args)
{
if (IsWarnEnabled)
UnityEngine.Debug.LogWarning(string.Format(format, args));
}
public void ErrorFormat(string format, params object[] args)
{
if (IsErrorEnabled)
UnityEngine.Debug.LogError(string.Format(format, args));
}
public void FatalFormat(string format, params object[] args)
{
if (IsFatalEnabled)
UnityEngine.Debug.LogError(string.Format(format, args));
}
/* Log a message string using the System.String.Format syntax */
public void DebugFormat(IFormatProvider provider, string format, params object[] args)
{
if (IsDebugEnabled)
UnityEngine.Debug.Log(string.Format(provider, format, args));
}
public void InfoFormat(IFormatProvider provider, string format, params object[] args)
{
if (IsInfoEnabled)
UnityEngine.Debug.Log(string.Format(provider, format, args));
}
public void WarnFormat(IFormatProvider provider, string format, params object[] args)
{
if (IsWarnEnabled)
UnityEngine.Debug.LogWarning(string.Format(provider, format, args));
}
public void ErrorFormat(IFormatProvider provider, string format, params object[] args)
{
if (IsErrorEnabled)
UnityEngine.Debug.LogError(string.Format(provider, format, args));
}
public void FatalFormat(IFormatProvider provider, string format, params object[] args)
{
if (IsFatalEnabled)
UnityEngine.Debug.LogError(string.Format(provider, format, args));
}
public void DebugFormat(string format, object arg0)
{
throw new NotImplementedException();
}
public void DebugFormat(string format, object arg0, object arg1)
{
throw new NotImplementedException();
}
public void DebugFormat(string format, object arg0, object arg1, object arg2)
{
throw new NotImplementedException();
}
public void InfoFormat(string format, object arg0)
{
throw new NotImplementedException();
}
public void InfoFormat(string format, object arg0, object arg1)
{
throw new NotImplementedException();
}
public void InfoFormat(string format, object arg0, object arg1, object arg2)
{
throw new NotImplementedException();
}
public void WarnFormat(string format, object arg0)
{
throw new NotImplementedException();
}
public void WarnFormat(string format, object arg0, object arg1)
{
throw new NotImplementedException();
}
public void WarnFormat(string format, object arg0, object arg1, object arg2)
{
throw new NotImplementedException();
}
public void ErrorFormat(string format, object arg0)
{
throw new NotImplementedException();
}
public void ErrorFormat(string format, object arg0, object arg1)
{
throw new NotImplementedException();
}
public void ErrorFormat(string format, object arg0, object arg1, object arg2)
{
throw new NotImplementedException();
}
public void FatalFormat(string format, object arg0)
{
throw new NotImplementedException();
}
public void FatalFormat(string format, object arg0, object arg1)
{
throw new NotImplementedException();
}
public void FatalFormat(string format, object arg0, object arg1, object arg2)
{
throw new NotImplementedException();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb68c75fd253c85448c34b1409a85083
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,147 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4479628772504131522
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6423719894035945655}
- component: {fileID: 3310727599597512245}
- component: {fileID: 7696877450501702533}
m_Layer: 0
m_Name: Main Menu Music 2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6423719894035945655
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4479628772504131522}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3310727599597512245
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4479628772504131522}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 887650ff1f3850a43aa8d1281fc70528, type: 3}
m_Name:
m_EditorClassIdentifier:
id: 2
audioTag: main_menu_music
pitchRange: 0.3
volumeRange: 0.3
--- !u!82 &7696877450501702533
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4479628772504131522}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: e64df9eb72ad48d47a43a5d0812ca086, type: 3}
m_PlayOnAwake: 0
m_Volume: 0.07
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 0
MinDistance: 1
MaxDistance: 100
Pan2D: 0
rolloffMode: 1
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 61b910cc5f77595498c96c310b5fec85
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: audio
assetBundleVariant:

View File

@ -0,0 +1,147 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4479628772504131522
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6423719894035945655}
- component: {fileID: 3310727599597512245}
- component: {fileID: 7696877450501702533}
m_Layer: 0
m_Name: Match Music
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6423719894035945655
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4479628772504131522}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3310727599597512245
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4479628772504131522}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 887650ff1f3850a43aa8d1281fc70528, type: 3}
m_Name:
m_EditorClassIdentifier:
id: 1
audioTag: match_music
pitchRange: 0.3
volumeRange: 0.3
--- !u!82 &7696877450501702533
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4479628772504131522}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: f075ab744dfba084690dc1039550d2e9, type: 3}
m_PlayOnAwake: 0
m_Volume: 0.025
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 0
MinDistance: 1
MaxDistance: 100
Pan2D: 0
rolloffMode: 1
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 51479316327e48040a5bb8e83e1b107d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: audio
assetBundleVariant:

View File

@ -135,6 +135,10 @@ PrefabInstance:
propertyPath: _defaultConditions.Array.size
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4393252310584637057, guid: 0b650fca685f2eb41a86538aa883e4c1, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7443408887813606049, guid: 0b650fca685f2eb41a86538aa883e4c1, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@ -191,6 +195,10 @@ PrefabInstance:
propertyPath: m_Name
value: NetworkManager
objectReference: {fileID: 0}
- target: {fileID: 7443408887813606051, guid: 0b650fca685f2eb41a86538aa883e4c1, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 7443408887813606060, guid: 0b650fca685f2eb41a86538aa883e4c1, type: 3}
m_RemovedGameObjects: []

View File

@ -2922,10 +2922,6 @@ PrefabInstance:
propertyPath: m_fontSize
value: 49.5
objectReference: {fileID: 0}
- target: {fileID: 2836659166924155329, guid: e269e0cd8b46eb94a8c118dc84754c33, type: 3}
propertyPath: m_HorizontalAlignment
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4688621401141212590, guid: e269e0cd8b46eb94a8c118dc84754c33, type: 3}
propertyPath: m_Delegates.Array.data[0].callback.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:

View File

@ -13,7 +13,7 @@ MonoBehaviour:
m_Name: DefaultRule
m_EditorClassIdentifier:
winCondition: 0
rounds: 3
rounds: 5
lives: 1
score: 0
time: -1

View File

@ -1,9 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using log4net;
using Managers;
using UnityEditor;
using UnityEngine;
public class AudioLibrary : MonoBehaviour

View File

@ -7,8 +7,10 @@ using UnityEngine.Events;
using UnityEngine.SceneManagement;
using FishNet;
using System.Collections.Generic;
using log4net;
using UnityEditor;
using log4net.Config;
using log4net;
using UnityEngine.Networking;
/// <summary>
/// The available scenes in the order they are in the build settings.
/// </summary>
@ -30,7 +32,7 @@ namespace Managers
public class GameManager : MonoBehaviour
{
private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Globally accessible member to use manager with.
@ -64,7 +66,7 @@ namespace Managers
{
G = this;
if (!IsTestRun) ShowStartScreen();
ConfigureLog4Net();
LogManager.ConfigureLogging();
Log.Info("Awake");
}
@ -83,16 +85,6 @@ namespace Managers
}
}
/// <summary>
/// Configuration of log 4 net, before the game starts.
/// </summary>
void ConfigureLog4Net()
{
log4net.GlobalContext.Properties["LogFileName"] = $"{Application.dataPath}" +
"\\Logging\\SSOLog";
// Log.Debug("Log4Net configured.");
}
/// <summary>
/// Instantiates the managers needed to play the game.
/// </summary>

View File

@ -140,6 +140,9 @@ namespace Managers
/// <param name="update">A change in the matches progression.</param>
public void UpdateMatchCondition(MatchConditionUpdate update)
{
// Quit updating when the round is over
if (CurrentMatchResult.IsRoundWon)
return;
Player updatedPlayer = null;
foreach (Player p in PlayerManager.G.MatchPlayers)
{
@ -169,7 +172,7 @@ namespace Managers
else
{
Log.Info($"Round {CurrentMatchResult.RoundsPlayed} of {MatchRule.rounds} has ended." +
$"{CurrentMatchResult.Winner?.name} won this round.");
$"{CurrentMatchResult.Winner?.playerName} won this round.");
AnnounceRoundWinner(CurrentMatchResult);
}
}
@ -278,11 +281,12 @@ namespace Managers
UIManager.G.Announcments.QueueAnnounceText($"{mr.Winner.playerName}" +
" has won the Round! \n" +
$"They won {winnerStats.RoundsWon} out of {MatchRule.rounds}.",
1.618f);
3f);
await Tween.Delay(1.618f * 0.33f);
await Tween.Delay(3f * 0.33f);
matchState = MatchState.Pause;
await Tween.Delay(1.618f * 0.66f);
ResetRound();
await Tween.Delay(3f * 0.66f);
ResetMatchCharacters();
@ -305,6 +309,14 @@ namespace Managers
SetupMatchPlayerStatistics();
}
/// <summary>
/// Resets the round statistics.
/// </summary>
public void ResetRound()
{
CurrentMatchResult.IsRoundWon = false;
}
/// <summary>
/// Initializes the match, waits for match begin
/// confirmation by the players and counts down to start.

View File

@ -16,6 +16,7 @@ namespace Managers
public Announcments Announcments { get; private set; }
public PauseMenu PauseMenu { get; private set; }
public MatchEndMenu MatchEndMenu { get; private set; }
public ManageableAudio MatchMusic;
/// <summary>
/// Globally accessible member to use manager with.
@ -108,6 +109,8 @@ namespace Managers
s.boostUI.SetPlayerName(p);
hUD.boostCapacities[p.playerNumber - 1].gameObject.SetActive(true);
}
MatchMusic = AudioManager.G.GetGlobalSound("match_music", 1, true);
MatchMusic.PlayAudio(true);
}
public void StartInputPrompt(Dictionary<int, Player> unassignedPlayers)
@ -129,21 +132,29 @@ namespace Managers
public void ShowPauseMenu(Transform transform)
{
hUD?.Hide();
PauseMenu?.Show(transform);
}
public void HidePauseMenu()
{
PauseMenu?.Hide();
hUD?.Show();
}
public void ShowMatchEndMenu(Transform transform)
{
hUD?.Hide();
MatchEndMenu?.Show(transform);
}
public void HideMatchEndMenu()
{
MatchEndMenu?.Hide();
hUD?.Show();
}
public void ShowHUD()
{
hUD?.Show();
}
public void HideHUD()

View File

@ -66,6 +66,7 @@ namespace GameLogic
/// Indicates whether a round or the whole match was won
/// </summary>
public bool IsMatchWon { get; private set; }
public bool IsRoundWon { get; set; }
public int RoundsPlayed { get; private set; }
public Player Winner { get; private set; }
public List<Player> Opponents { get; private set; }
@ -86,25 +87,35 @@ namespace GameLogic
Opponents = mps.Keys.Where(player => player != Winner).ToList();
mps[Winner].RoundsWon += 1;
RoundsPlayed += 1;
IsRoundWon = true;
}
else
{
Winner = null;
}
// TODO: this is wrong winning 2 rounds can decide the match
foreach (Player p in mps.Keys)
{
if (mps[p].RoundsWon > rules.rounds / 2)
{
IsMatchWon = true;
Winner = p;
Opponents = mps.Keys.Where(player => player != Winner).ToList();
return;
}
}
if (RoundsPlayed == rules.rounds)
{
IsMatchWon = true;
Winner = mps.Aggregate((p1, p2) =>
p1.Value.RoundsWon > p2.Value.RoundsWon ? p1 : p2).Key;
Opponents = mps.Keys.Where(player => player != Winner).ToList();
return;
}
else
foreach (var statistic in mps.Values)
{
foreach (var statistic in mps.Values)
{
statistic.IsOut = false;
}
statistic.IsOut = false;
}
}
}

View File

@ -36,4 +36,9 @@ public class HUD : MonoBehaviour
canvas.enabled = false;
}
public void Show()
{
canvas.enabled = true;
}
}

View File

@ -53,6 +53,7 @@ public class MatchEndMenu : MonoBehaviour
public void OnMainMenu()
{
UIManager.G.MatchMusic.FadeOutAudio(0.3f, true);
StartCoroutine(StartSceneTransition());
}

View File

@ -55,6 +55,7 @@ public class PauseMenu : MonoBehaviour
public void OnMainMenu()
{
UIManager.G.MatchMusic.FadeOutAudio(0.3f, true);
StartCoroutine(StartSceneTransition());
}

View File

@ -105,7 +105,7 @@ namespace SlimUI.ModernMenu
firstMenu.SetActive(true);
// Position1();
SetThemeColors();
MainMenuMusic = AudioManager.G.GetGlobalSound("main_menu_music", 1, false);
MainMenuMusic = AudioManager.G.GetGlobalSound("main_menu_music", 2, false);
MainMenuMusic.PlayAudio(true);
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9131c6ca36625b44180bc88c303f8e89
guid: 13e70c295bae521458004f57dfd9a2a9
folderAsset: yes
DefaultImporter:
externalObjects: {}

BIN
Assets/_lib/log4net.dll Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ffda049d4c0ac8944953e736728028af
guid: 6b05703ded3591c46a671e4977492a3e
PluginImporter:
externalObjects: {}
serializedVersion: 2
@ -9,6 +9,7 @@ PluginImporter:
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:

View File

@ -1,53 +0,0 @@
# 1.0.5
* [Fix] Exception messages now has clickable source code links for Unity 2020+ versions
# 1.0.4
* [Deploy] Now github actions not build release if no changes in source files detected
* [Deploy] Now github actions not try upload new release if version of package not changed
* [Update] Update log4net to 2.0.12
* [Fix] Remove all ASP, System.Web, Mutex and some OS related features from log4net for better compatibility with some Unity platforms
* [Fix] All dll's now has better linker information for code stripping process
# 1.0.3
* [Feature] log4net.editor and log4net.runtime files now supported as config files in default configurators
# 1.0.2
* [Deploy] Add some lost meta files
* [Info] Add author info
# 1.0.1
* [Deploy] Add auto deployment
# 1.0.0
* [Refactor] Rename project and all assemblies to match unity convention.
* [WIP] Build folder now can be used as local package for unity. Package branch and publication in public npm repository still in progress.
# 0.3.3
* [Fix] Silent crash of editor when start with non compiled scripts no longer happens.
# 0.3.2
* [Add] Add context object as log event property.
# 0.3.1
* [Fix] Infinity exception loops in editor start or recompile no longer happens.
# 0.2.2
* [Fix] Change editor initialization algorithm.
# 0.2.1
* [Feature] Exception stack trace now clickable in editor console.
# 0.0.0
* Begin of journey =)

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 7c29e57692dc4cf39b38af880788a530
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: ed59742223874bc1bc700f6078e62fd8
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,116 +0,0 @@
fileFormatVersion: 2
guid: e0a45af9bf6b3b445aea3dd011c5066d
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude WindowsStoreApps: 1
Exclude iOS: 1
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
DontProcess: false
PlaceholderPath:
SDK: AnySDK
ScriptingBackend: AnyScriptingBackend
- first:
iPhone: iOS
second:
enabled: 0
settings:
AddToEmbeddedBinaries: false
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 2c5c378cb78e84540a097dc8c84dc678
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,15 +0,0 @@
log4uni
Copyright 2021 Holy Shovel Soft
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Licensed under the Apache License 2.0.
With modifications especialy for Unity Engine:
- make log4net.Util.SystemInfo.GetAppSetting(string key) always return null for compatibility with some platforms reason (Holy Shovel Soft 2019)
- remove all ASP related features (appenders and templates) (Holy Shovel Soft 2021)
- remove all System.Web usages (appenders and templates) (Holy Shovel Soft 2021)
- remove all Mutex usages (FileAppender and RollingFileAppender) (Holy Shovel Soft 2021)
This product use software developed by Jb Evain
Licensed under the MIT License

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 62dfff47a3671b048a6de1a508d67919
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,205 +0,0 @@
# log4uni
[![openupm](https://img.shields.io/npm/v/com.holyshovelsoft.opensource.log4uni?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.holyshovelsoft.opensource.log4uni/)
[![release](https://img.shields.io/github/v/release/holyshovelsoft/log4uni.svg)](https://github.com/HolyShovelSoft/log4uni/releases/latest)
This package its [log4net](https://logging.apache.org/log4net/) wrapper and UnityEngine.Debug appender for Unity.
For greater compatibility .NET Framework 3.5 is used.
This project was tested only on platforms available to the author (Windows, Android, WebGL), but we expect that plugin must work fine on other plaforms, supported by **Unity**.
> Projects author does not guarantee **log4net** or third-party **Appenders** working properly, as some platforms are limited in their abilities, and could not be supporting some **.net** functions.
> Also this package use custom patched **log4net.dll** (2.0.12) for work with **Unity** il2cpp and AOT platforms.
## Instalation
### Manual
1. Download the latest release at [link](https://github.com/HolyShovelSoft/log4net.unity/releases).
2. Unpack files into your Unity project.
3. Make sure that log4uni.editor.dll is set up to be used only in the editor.
### As package from git
You can use this tool as package via git link `ssh://git@github.com:HolyShovelSoft/log4uni.git#upm` or `https://github.com/HolyShovelSoft/log4uni.git#upm`. About installation packages from git you can read in this [manual](https://docs.unity3d.com/Manual/upm-ui-giturl.html).
### As package from **OpenUPM**
[Link to package](https://openupm.com/packages/com.holyshovelsoft.opensource.log4uni/)
You can install it with OpenUPM CLI with code
```
openupm add com.holyshovelsoft.opensource.log4uni
```
About installation and using OpenUPM CLI you can read [here](https://openupm.com/docs/getting-started.html).
The second installation method is [scoped registries](https://docs.unity3d.com/Manual/upm-scoped.html). You need add registry `https://package.openupm.com` with name **OpenUPM** for scope `com.holyshovelsoft.opensource`.
## UnityDefaultLogAppender and Unity log handlers
**UnityDefaultLogAppender** is an **Appender** for log4net, which integrates log4net loggers with Unity logger (for both runtime and editor). This plugin also replaces default Unity **ILogHandler** with a handler which sends all **Debug.Log** standard calls into log4net and lets you control default logging method with configurations.
All standard calls will be interpreted as log4net loggers with a name "Unity".
## Very Simple Usage
After installation all that's required is to use old methods in the code:
``` csharp
//In this case common ILog instance will be used
Debug.Log("Debug message");
```
Or to use loggers as indended by log4net =)
``` csharp
private static readonly ILog Log = LogManager.GetLogger("MyLogger");
//or
private static readonly ILog Log = LogManager.GetLogger(typeof(MyType));
//and after it use this instances for logs
if (Log.IsInfoEnabled)
{
Log.Info("Info message");
}
//or for .net 4.6 and higher you can use extention methods
Log.Info()?.Call("Info message");
```
Thats it, you are great, you are already using log4net! =)
## Simple Usage
But what about configurations and what we love log4net for? There are several ways to configure log4net in this plugin. The easiest is to place log4net configuration file( the only addition requirment is that **log4net** node must be root) in the following places (in the checking order):
1. Into the folder **Application.persistentDataPath**. Valid configuration files are
- **log4net.editor.xml**, **log4net.editor.config** or **log4net.editor.txt** for editor configuration.
- **log4net.runtime.xml**, **log4net.runtime.config** or **log4net.runtime.txt** for runtime build configuration.
- **log4net.xml**, **log4net.config** or **log4net.txt** for both (editor and runtime build).
2. Into the folder **Application.dataPath**. Valid configuration files are
- **log4net.editor.xml**, **log4net.editor.config** or **log4net.editor.txt** for editor configuration.
- **log4net.runtime.xml**, **log4net.runtime.config** or **log4net.runtime.txt** for runtime build configuration.
- **log4net.xml**, **log4net.config** or **log4net.txt** for both (editor and runtime build).
3. Into any Resources folder within the project. Files placed in subfolders not supported. Its must be any **TextAsset**. Valid asset names are:
- **log4net.editor** for editor configuration.
- **log4net.runtime** for runtime build configuration.
- **log4net** for both (editor and runtime build).
In case none of the following configuration acquisition methods doesn't find a valid configuration, default configuration will be used. In particular:
``` xml
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<appender name="unityConsole" type="log4net.Unity.UnityDefaultLogAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%thread][%level][%logger] %message"/>
</layout>
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="unityConsole"/>
</root>
</log4net>
```
When any of the files if updated when working in editor, log4net reconfiguration will be called. In build file updating is not tracked, only the state at launch is considered.
> This configuration can also be saved to file using **Unity** command **Tools/log4net/Make Default Config**.
## Advanced Usage
But what if we need to configure log4net with code, and not by updating configuration file, or to use complex conditions for selecting configuration? In this case you can use the following interface to customize configuration process:
``` csharp
public interface IConfigurator
{
int Order { get; }
event Action OnChange;
void TryConfigure();
}
```
To understand this interface, we need to understand how configuration works in this plugin. When launching editor (and when recompiling) or during the build running the following operations occur:
1. Reset of existing log4net configuration.
2. Collect of all information about **IConfigurator** interface implementations.
3. Filling in the list of all found configuratiors according to the following rules:
- Classes (not nested), not inhereted from **UnityEngine.Object**, that have constructor without parameters (or without declared constructors) and not marked with a **[ExcludeFromSearch]** attribute, are instantiated automatically and are placed in the common configurators list.
- Objects inherited from **ScriptableObject** and placed in **Resources** are also placed in the common configurators list.
- Default configurators added to the list (with the highest possible **Order** value).
4. Resulting list is sorted from the lowest **Order** value to highest.
5. Every configurator in the list is calling a method **TryConfigure** one by one. If after calling that method **log4net** is configurated, then list iterating is stopped.
Besides this you can also use following methods to add or delete configurators:
``` csharp
ConfigProcessor.AddConfigurator(myConfigurator);
ConfigProcessor.RemoveConfigurator(myConfigurator);
```
Calling these methods causes reconfiguration, as well as triggering **OnChange** event in any configurator added to the list.
> **Imprtant**
> If you need to use logging inside configurator, use **UnityDefaultLogHandler.DefaultUnityLogger**. This is necessary because during configurators work, log4net is not configured and all logs will go into the void. **UnityDefaultLogHandler.DefaultUnityLogger** is a fallback to a standard **Unity** logging system.
## Configurators samples
``` csharp
[ExcludeFromSearch]
public class SimpleXMLConfigurator : IConfigurator
{
public int Order { get; }
public event Action OnChange;
private string xml;
public SimpleXMLConfigurator(int order, string xml)
{
Order = order;
this.xml = xml;
}
public void TryConfigure()
{
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
log4net.Config.XmlConfigurator.Configure(xmlDoc.DocumentElement);
}
}
```
``` csharp
[ExcludeFromSearch]
public class SimpleCodeConfigurator : IConfigurator
{
public int Order { get; }
public event Action OnChange;
public SimpleCodeConfigurator(int order)
{
Order = order;
}
public void TryConfigure()
{
var hierarchy = (Hierarchy)LogManager.GetRepository();
var patternLayout = new PatternLayout();
patternLayout.ConversionPattern = "[%thread][%level][%logger] %message";
patternLayout.ActivateOptions();
var appender = new UnityDefaultLogAppender();
appender.Layout = patternLayout;
hierarchy.Root.AddAppender(appender);
hierarchy.Root.Level = Level.Info;
hierarchy.Configured = true;
}
}
```
## Contacts
- [twitter.com/holyshovelsoft](https://twitter.com/holyshovelsoft)
- [support@holyshovelsoft.com](mailto:support@holyshovelsoft.com)
- [andreich@holyshovelsoft.com](mailto:andreich@holyshovelsoft.com)

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 7153e10cfeec42d4879694d52890757c
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Binary file not shown.

View File

@ -1,32 +0,0 @@
fileFormatVersion: 2
guid: 8fc9fb3fde8b09e40afdd6740a270db4
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,24 +0,0 @@
{
"name": "com.holyshovelsoft.opensource.log4uni",
"displayName": "log4uni",
"version": "1.0.5",
"unity": "2019.1",
"description": "log4net wrapper and UnityEngine.Debug appender for Unity.",
"keywords": [
"tool",
"log",
"log4net",
"unity"
],
"dependencies": {
},
"author": {
"name": "Holy Shovel Soft",
"email": "support@holyshovelsoft.com",
"url": "https://github.com/HolyShovelSoft/log4uni.git"
},
"repository": {
"url": "https://github.com/HolyShovelSoft/log4uni.git",
"type": "git"
}
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: e1882989817643caba88c9f39a4d92c8
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -345,7 +345,7 @@ PlayerSettings:
m_Automatic: 1
- m_BuildTarget: WebGLSupport
m_APIs: 0b000000
m_Automatic: 0
m_Automatic: 1
m_BuildTargetVRSettings:
- m_BuildTarget: Standalone
m_Enabled: 0
@ -662,8 +662,7 @@ PlayerSettings:
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend: {}
il2cppCompilerConfiguration:
WebGL: 0
il2cppCompilerConfiguration: {}
il2cppCodeGeneration: {}
managedStrippingLevel:
EmbeddedLinux: 1