Changeset 354
- Timestamp:
- Aug 16, 2019, 7:58:34 PM (5 years ago)
- Location:
- binary-improvements
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r345 r354 10 10 <AssemblyName>7dtd-server-fixes</AssemblyName> 11 11 <RootNamespace>AllocsFixes</RootNamespace> 12 <TargetFrameworkVersion>v 3.5</TargetFrameworkVersion>12 <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> 13 13 </PropertyGroup> 14 14 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> … … 77 77 <ItemGroup> 78 78 <Compile Include="src\AssemblyInfo.cs" /> 79 <Compile Include="src\JSON\JsonManualBuilder.cs" /> 79 80 <Compile Include="src\LiveData\Animals.cs" /> 80 81 <Compile Include="src\LiveData\Hostiles.cs" /> -
binary-improvements/7dtd-server-fixes/src/API.cs
r345 r354 89 89 if (_cInfo != null) { 90 90 Log.Out ("Sent chat hook reply to {0}", _cInfo.playerId); 91 _cInfo.SendPackage ( new NetPackageChat(EChatType.Whisper, -1, ANSWER, "", false, null));91 _cInfo.SendPackage (NetPackageManager.GetPackage<NetPackageChat> ().Setup (EChatType.Whisper, -1, ANSWER, "", false, null)); 92 92 } else { 93 93 Log.Error ("ChatHookExample: Argument _cInfo null on message: {0}", _msg); -
binary-improvements/7dtd-server-fixes/src/PersistentData/InvItem.cs
r351 r354 14 14 public int maxUseTimes; 15 15 [OptionalField] 16 public int useTimes;16 public float useTimes; 17 17 18 public InvItem (string _itemName, int _count, int _quality, int _maxUseTimes, int _maxUse) {18 public InvItem (string _itemName, int _count, int _quality, int _maxUseTimes, float _maxUse) { 19 19 itemName = _itemName; 20 20 count = _count; -
binary-improvements/AllocsCommands/AllocsCommands.csproj
r330 r354 10 10 <RootNamespace>AllocsCommands</RootNamespace> 11 11 <AssemblyName>AllocsCommands</AssemblyName> 12 <TargetFrameworkVersion>v 3.5</TargetFrameworkVersion>12 <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> 13 13 </PropertyGroup> 14 14 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> -
binary-improvements/AllocsCommands/Chat.cs
r335 r354 10 10 } 11 11 12 _receiver.SendPackage ( new NetPackageChat(EChatType.Whisper, -1, _message, senderName + " (PM)", false, null));12 _receiver.SendPackage (NetPackageManager.GetPackage<NetPackageChat> ().Setup (EChatType.Whisper, -1, _message, senderName + " (PM)", false, null)); 13 13 string receiverName = _receiver.playerName; 14 14 SdtdConsole.Instance.Output ("Message to player " + -
binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs
r351 r354 53 53 54 54 public bool LoadIcons () { 55 55 56 lock (icons) { 56 57 if (loaded) { … … 59 60 60 61 MicroStopwatch microStopwatch = new MicroStopwatch (); 61 62 GameObject atlasObj = GameObject.Find ("/NGUI Root (2D)/ItemIconAtlas");63 if (atlasObj == null) {64 Log.Error ("Web:IconHandler: Atlas object not found");65 loaded = true;66 return false;67 }68 69 DynamicUIAtlas atlas = atlasObj.GetComponent<DynamicUIAtlas> ();70 if (atlas == null) {71 Log.Error ("Web:IconHandler: Atlas component not found");72 loaded = true;73 return false;74 }75 76 string textureResourceName = atlas.PrebakedAtlas;77 List<UISpriteData> sprites;78 int elementWidth, elementHeight;79 Texture2D atlasTex;80 81 if (!DynamicUIAtlasTools.ReadPrebakedAtlasDescriptor (textureResourceName, out sprites,82 out elementWidth, out elementHeight)) {83 SdtdConsole.Instance.Output ("Web:IconHandler: Could not read dynamic atlas descriptor");84 return false;85 }86 87 if (!DynamicUIAtlasTools.ReadPrebakedAtlasTexture (textureResourceName, out atlasTex)) {88 SdtdConsole.Instance.Output ("Web:IconHandler: Could not read dynamic atlas texture");89 return false;90 }91 62 92 63 // Get list of used tints for all items … … 107 78 } 108 79 109 // Load icons from vanilla 110 foreach (UISpriteData data in sprites) { 111 string name = data.name; 112 Texture2D tex = new Texture2D (data.width, data.height, TextureFormat.ARGB32, false); 113 tex.SetPixels (atlasTex.GetPixels (data.x, atlasTex.height - data.height - data.y, data.width, 114 data.height)); 115 116 AddIcon (name, tex, tintedIcons); 117 118 Object.Destroy (tex); 80 try { 81 loadIconsFromFolder (Utils.GetGameDir ("Data/ItemIcons"), tintedIcons); 82 } catch (Exception e) { 83 Log.Error ("Failed loading icons from base game"); 84 Log.Exception (e); 119 85 } 120 121 Resources.UnloadAsset (atlasTex);122 86 123 87 // Load icons from mods … … 125 89 try { 126 90 string modIconsPath = mod.Path + "/ItemIcons"; 127 if (Directory.Exists (modIconsPath)) { 128 foreach (string file in Directory.GetFiles (modIconsPath)) { 129 try { 130 if (file.EndsWith (".png", StringComparison.OrdinalIgnoreCase)) { 131 string name = Path.GetFileNameWithoutExtension (file); 132 Texture2D tex = new Texture2D (1, 1, TextureFormat.ARGB32, false); 133 if (tex.LoadImage (File.ReadAllBytes (file))) { 134 if (tex.width == elementWidth && tex.height == elementHeight) { 135 AddIcon (name, tex, tintedIcons); 136 } 137 138 Object.Destroy (tex); 139 } 140 } 141 } catch (Exception e) { 142 Log.Exception (e); 143 } 144 } 145 } 91 loadIconsFromFolder (modIconsPath, tintedIcons); 146 92 } catch (Exception e) { 93 Log.Error ("Failed loading icons from mod " + mod.ModInfo.Name.Value); 147 94 Log.Exception (e); 148 95 } … … 153 100 154 101 return true; 102 } 103 } 104 105 private void loadIconsFromFolder (string _path, Dictionary<string, List<Color>> _tintedIcons) { 106 if (Directory.Exists (_path)) { 107 foreach (string file in Directory.GetFiles (_path)) { 108 try { 109 if (file.EndsWith (".png", StringComparison.OrdinalIgnoreCase)) { 110 string name = Path.GetFileNameWithoutExtension (file); 111 Texture2D tex = new Texture2D (1, 1, TextureFormat.ARGB32, false); 112 if (tex.LoadImage (File.ReadAllBytes (file))) { 113 AddIcon (name, tex, _tintedIcons); 114 115 Object.Destroy (tex); 116 } 117 } 118 } catch (Exception e) { 119 Log.Exception (e); 120 } 121 } 155 122 } 156 123 } -
binary-improvements/MapRendering/WebAndMapRendering.csproj
r331 r354 10 10 <RootNamespace>MapRendering</RootNamespace> 11 11 <AssemblyName>MapRendering</AssemblyName> 12 <TargetFrameworkVersion>v 3.5</TargetFrameworkVersion>12 <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> 13 13 </PropertyGroup> 14 14 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
Note:
See TracChangeset
for help on using the changeset viewer.