Weapos Rejiggered
Modified weapon scripts to eliminate specialized projectile behavior - allows charged weapons to have projectiles and modify weapon stats when charged Added machine gun weapon & VFX Moved third party code to Plugins folder to improve compile times
This commit is contained in:
parent
2a0fe34611
commit
dbc522a224
2105 changed files with 7033 additions and 1141 deletions
|
|
@ -1,57 +0,0 @@
|
|||
// Copyright (c) All contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Linq; // require UNITY_2018_3_OR_NEWER
|
||||
using System.Reflection;
|
||||
using MessagePack.Formatters;
|
||||
|
||||
namespace MessagePack.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// Get formatter from <see cref="MessagePackFormatterAttribute"/>.
|
||||
/// </summary>
|
||||
public sealed class AttributeFormatterResolver : IFormatterResolver
|
||||
{
|
||||
/// <summary>
|
||||
/// The singleton instance that can be used.
|
||||
/// </summary>
|
||||
public static readonly AttributeFormatterResolver Instance = new AttributeFormatterResolver();
|
||||
|
||||
private AttributeFormatterResolver()
|
||||
{
|
||||
}
|
||||
|
||||
public IMessagePackFormatter<T> GetFormatter<T>()
|
||||
{
|
||||
return FormatterCache<T>.Formatter;
|
||||
}
|
||||
|
||||
private static class FormatterCache<T>
|
||||
{
|
||||
public static readonly IMessagePackFormatter<T> Formatter;
|
||||
|
||||
static FormatterCache()
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER && !NETFX_CORE
|
||||
var attr = (MessagePackFormatterAttribute)typeof(T).GetCustomAttributes(typeof(MessagePackFormatterAttribute), true).FirstOrDefault();
|
||||
#else
|
||||
MessagePackFormatterAttribute attr = typeof(T).GetTypeInfo().GetCustomAttribute<MessagePackFormatterAttribute>();
|
||||
#endif
|
||||
if (attr == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (attr.Arguments == null)
|
||||
{
|
||||
Formatter = (IMessagePackFormatter<T>)Activator.CreateInstance(attr.FormatterType);
|
||||
}
|
||||
else
|
||||
{
|
||||
Formatter = (IMessagePackFormatter<T>)Activator.CreateInstance(attr.FormatterType, attr.Arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue