Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions OpenDreamClient/Interface/DreamInterfaceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -972,17 +972,17 @@ private void LoadInterface(InterfaceDescriptor descriptor) {
}

private void OnWindowFocused(WindowFocusedEventArgs args) {
if(ClydeWindowIdToControl.TryGetValue(args.Window.Id, out var controlWindow)){
_sawmill.Debug($"window id {controlWindow.Id} was {(args.Focused ? "focused" : "defocused")}");
WindowDescriptor descriptor = (WindowDescriptor) controlWindow.ElementDescriptor;
if (ClydeWindowIdToControl.TryGetValue(args.Window.Id, out var controlWindow)) {
_sawmill.Verbose($"window id {controlWindow.Id} was {(args.Focused ? "focused" : "defocused")}");
WindowDescriptor descriptor = (WindowDescriptor)controlWindow.ElementDescriptor;
descriptor.Focus = new DMFPropertyBool(args.Focused);
if(args.Focused && MacroSets.TryGetValue(descriptor.Macro.AsRaw(), out var windowMacroSet)){
_sawmill.Debug($"Activating macroset {descriptor.Macro}");
if (args.Focused && MacroSets.TryGetValue(descriptor.Macro.AsRaw(), out var windowMacroSet)) {
_sawmill.Verbose($"Activating macroset {descriptor.Macro}");
windowMacroSet.SetActive();
}
} else {
_sawmill.Verbose($"window id was not found (probably a modal) but was {(args.Focused ? "focused" : "defocused")}");
}
else
_sawmill.Debug($"window id was not found (probably a modal) but was {(args.Focused ? "focused" : "defocused")}");
}

private void LoadDescriptor(ElementDescriptor descriptor) {
Expand Down
17 changes: 10 additions & 7 deletions OpenDreamClient/Resources/DreamResourceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,23 @@ private void EnsureCacheDirectory() {
}

private void RxBrowseResource(MsgBrowseResource message) {
_sawmill.Debug($"Received cache check for {message.Filename} hash: {BitConverter.ToString(message.DataHash)}");
_sawmill.Verbose($"Received cache check for {message.Filename} hash: {BitConverter.ToString(message.DataHash)}");
EnsureCacheDirectory();
if(_resourceManager.UserData.Exists(GetCacheFilePath(message.Filename)) && GetFileHash(GetCacheFilePath(message.Filename)).SequenceEqual(message.DataHash)){
_sawmill.Debug($"Cache hit for {message.Filename}");
_sawmill.Verbose($"Cache hit for {message.Filename}");
} else {
if (_activeBrowseRscRequests.Contains(message.Filename)) //we've already requested it, don't need to do it again
return;

if (_resourceManager.UserData.Exists(GetCacheFilePath(message.Filename))) {
_sawmill.Debug($"Cache hit for {message.Filename} but hashes did not match (hash: {BitConverter.ToString(GetFileHash(GetCacheFilePath(message.Filename)))}). Re-requesting!");
_resourceManager.UserData.Delete(GetCacheFilePath(message.Filename));
} else
} else {
_sawmill.Debug($"Cache miss for {message.Filename}, requesting from server.");
}

_activeBrowseRscRequests.Add(message.Filename);
_netManager.ServerChannel?.SendMessage(new MsgBrowseResourceRequest() { Filename = message.Filename });
_netManager.ServerChannel?.SendMessage(new MsgBrowseResourceRequest { Filename = message.Filename });
}
}

Expand Down Expand Up @@ -145,7 +148,7 @@ private void RxResourceUpdateNotification(MsgNotifyResourceUpdate message) {
if (!_loadingResources.ContainsKey(message.ResourceId) && _resourceCache.TryGetValue(message.ResourceId, out var cached)) { //either we're already requesting it, or we don't have it so don't need to update
_sawmill.Debug($"Resource id {message.ResourceId} was updated, reloading");
_loadingResources[message.ResourceId] = new LoadingResourceEntry(cached.GetType());
var msg = new MsgRequestResource() { ResourceId = message.ResourceId };
var msg = new MsgRequestResource { ResourceId = message.ResourceId };
_netManager.ClientSendMessage(msg);
}
}
Expand Down Expand Up @@ -191,7 +194,7 @@ public void LoadResourceAsync<T>(int resourceId, Action<T> onLoadCallback) where
if (!_loadingResources.ContainsKey(resourceId)) {
_loadingResources[resourceId] = new LoadingResourceEntry(typeof(T));

var msg = new MsgRequestResource() { ResourceId = resourceId };
var msg = new MsgRequestResource { ResourceId = resourceId };
_netManager.ClientSendMessage(msg);

var timeout = _cfg.GetCVar(OpenDreamCVars.DownloadTimeout);
Expand Down Expand Up @@ -290,7 +293,7 @@ public void LookupResourceAsync(string resourcePathOrRef, Action<int> onSuccess,
_pendingResourceLookups[resourcePathOrRef].SuccessCallbacks.Add(onSuccess);
_pendingResourceLookups[resourcePathOrRef].FailureCallbacks.Add(onFailure);

var msg = new MsgLookupResource() { ResourcePathOrRef = resourcePathOrRef };
var msg = new MsgLookupResource { ResourcePathOrRef = resourcePathOrRef };
_netManager.ClientSendMessage(msg);

var timeout = _cfg.GetCVar(OpenDreamCVars.DownloadTimeout);
Expand Down
2 changes: 1 addition & 1 deletion OpenDreamShared/Interface/DMF/DMFParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public Dictionary<string, string> AttributesValues() {
if (winset.Value == "none")
continue;

attributes.Add(winset.Attribute, winset.Value);
attributes[winset.Attribute] = winset.Value;
}

return attributes;
Expand Down
Loading