Cetera Posted April 1, 2016 Share Posted April 1, 2016 On 3/30/2016 at 10:15 AM, Thomas P. said: And that there are two of them, depending on what version the user runs, KSP.exe or KSP_x64.exe, which can (and will) result in support nightmares. Well, most modders before simply refused to mess with 64-bit implementations. If they only want to support 64-bit only going forward, that would seem to be a similar solution. It has been more than 10 years since 64-bit was standard in every processor sold, and I doubt there are many 10-year-old PCs out there running KSP. Has there been a 32-bit-only OS sold in the last eight years? I'm sure there has, for some forsaken POS legacy application that is 16-bit and simply can't be made to run in a 64-bit environment, but again I think that is a rarity. Just stop supporting the 32-bit environment. No one running mods is going to be using it. Link to comment Share on other sites More sharing options...
kujuman Posted April 1, 2016 Share Posted April 1, 2016 20 hours ago, linuxgurugamer said: Some of my mods respond to a right-click on the toolbar button (stock toolbar) It's not working anymore. However, left-button clicks still work. Dunno if a change in functionality, but I'd previously (in 1.0.5) used if (Event.current.button == 1) { //stuff } to check for right-clicks. http://docs.unity3d.com/ScriptReference/Event-button.html. In 1.1, I changed it to if (Event.current.alt) { //stuff } and now fires when the user holds down the Mod key and clicks on the AppButton. See if either of those work for you. Link to comment Share on other sites More sharing options...
linuxgurugamer Posted April 1, 2016 Share Posted April 1, 2016 58 minutes ago, kujuman said: Dunno if a change in functionality, but I'd previously (in 1.0.5) used if (Event.current.button == 1) { //stuff } to check for right-clicks. http://docs.unity3d.com/ScriptReference/Event-button.html. In 1.1, I changed it to if (Event.current.alt) { //stuff } and now fires when the user holds down the Mod key and clicks on the AppButton. See if either of those work for you. Nothing to do with that, although thanks for the info. This is a confirmed bug, and I reported it on the bugtracker. Right clicks are not being passed at all to the associated function from the toolbar. Once they fix that, I'll keep what you have in mind. Thanks Link to comment Share on other sites More sharing options...
linuxgurugamer Posted April 1, 2016 Share Posted April 1, 2016 Apparently the MultiOptionDialog call has changed. It used to have the ability to call a callback function, now that callback is not allowed anymore Can someone else confirm this? Link to comment Share on other sites More sharing options...
sarbian Posted April 1, 2016 Author Share Posted April 1, 2016 5 hours ago, Cetera said: Has there been a 32-bit-only OS sold in the last eight years? Every Microsoft OS ? You can install Win 10 in 32bit. It is stupid since processor have been 64bit for more than a decade but many people still do it. @linuxgurugamer the default Unity UI Button implementation only register left click. Squad most likely use that. It's an easy fix, I did it for some of my code. I have a MultiOptionDialog example at home. I ll dig it after work if no one replied before. Link to comment Share on other sites More sharing options...
Alewx Posted April 1, 2016 Share Posted April 1, 2016 22 minutes ago, sarbian said: Every Microsoft OS ? You can install Win 10 in 32bit. It is stupid since processor have been 64bit for more than a decade but many people still do it. @linuxgurugamer the default Unity UI Button implementation only register left click. Squad most likely use that. It's an easy fix, I did it for some of my code. I have a MultiOptionDialog example at home. I ll dig it after work if no one replied before. @sarbian do you also get crazy with unitys new UI, which is so totally insane to create by source, or did you find a way to handle the things? Link to comment Share on other sites More sharing options...
sarbian Posted April 1, 2016 Author Share Posted April 1, 2016 (edited) 11 minutes ago, Alewx said: @sarbian do you also get crazy with unitys new UI, which is so totally insane to create by source, or did you find a way to handle the things? Read the 3 post in this very thread where I already answered that ? 1 & 2 & 3 Edited April 1, 2016 by sarbian Link to comment Share on other sites More sharing options...
linuxgurugamer Posted April 1, 2016 Share Posted April 1, 2016 56 minutes ago, sarbian said: Every Microsoft OS ? You can install Win 10 in 32bit. It is stupid since processor have been 64bit for more than a decade but many people still do it. @linuxgurugamer the default Unity UI Button implementation only register left click. Squad most likely use that. It's an easy fix, I did it for some of my code. I have a MultiOptionDialog example at home. I ll dig it after work if no one replied before. ok, but the right click on the toolbar was working in 1.0.5, and @sal_vager confirmed that it was a mistake. For now, I've changed the way the mod works a bit. I was using the right-click to bring up the setting window, and left-click to display some info. The changes I made are that the left click brings up the settings window, and the info window is now an option. This is in my TotalTime mod, but I do use the right-click on the toolbar in other mods. Re. the MultiOptionDialog, this is in KRASH (was in the old Holodeck) code. I found some examples on how to do it without using a callback, so unless I hear another way to use a callback function, I'll probably recode the dialogs Link to comment Share on other sites More sharing options...
Alewx Posted April 1, 2016 Share Posted April 1, 2016 33 minutes ago, sarbian said: Read the 3 post in this very thread where I already answered that ? 1 & 2 & 3 @sarbian I missed the last one that was the reason I asked. but you still use prefabs. prefabs are, different to the old system to say at least. Link to comment Share on other sites More sharing options...
sarbian Posted April 1, 2016 Author Share Posted April 1, 2016 I do both. I don't know what I will do in the future. Prefab limit the use of Stock code and I consider it sad to not re-use the work of the devs. Link to comment Share on other sites More sharing options...
SpaceTiger Posted April 1, 2016 Share Posted April 1, 2016 I'm currently having some issues with the ui dropdown elements. The options seem to get put behind its parent and i can't select any of them. I'm adding new options like this: dropdownElement.options.Add(new Dropdown.OptionData("Part__")); And it results in this: In the editor however it works perfectly fine then again I'm not adding new options in the editor. Link to comment Share on other sites More sharing options...
Alewx Posted April 1, 2016 Share Posted April 1, 2016 16 minutes ago, SpaceTiger said: I'm currently having some issues with the ui dropdown elements. The options seem to get put behind its parent and i can't select any of them. I'm adding new options like this: dropdownElement.options.Add(new Dropdown.OptionData("Part__")); And it results in this: In the editor however it works perfectly fine then again I'm not adding new options in the editor. There is RectTransform.setLastSibbling() which should according to Unity Tutorial pull an UI element in the first position so that it is drawn above all others. Link to comment Share on other sites More sharing options...
SpaceTiger Posted April 1, 2016 Share Posted April 1, 2016 5 minutes ago, Alewx said: There is RectTransform.setLastSibbling() which should according to Unity Tutorial pull an UI element in the first position so that it is drawn above all others. I tried that and it didn't change anything. Probably cause its a child of the background therefore should already be drawn at least over it which isn't the case as evident by the picture. There is RefreshShownValue but that's only exposed at Unity 5.3 which we aren't using yet. Then there was a suggestion to use TestDropDown.captionText = TestDropDown.captionText; or change the index and reset it both didn't do the trick. Maybe the issue is that I'm assigning my panel as a child of the stock ui ? But that's probably not the case. Link to comment Share on other sites More sharing options...
sarbian Posted April 1, 2016 Author Share Posted April 1, 2016 play with the position z. I will push my version of the Unity-Ui-extenssion repo with some fix related to KSP tonight. I guess we could use that and Ziw code as a start for a new lib. Link to comment Share on other sites More sharing options...
SpaceTiger Posted April 1, 2016 Share Posted April 1, 2016 (edited) I figured out what was causing the issue. The stock canvas is in a custom sorting layer. Since the part tools don't show us that it's not easy to find out! Easy workaround to use in your ui init : var template = dropdown.transform.FindChild("Template"); var canvas = template.GetComponent<Canvas>(); if (canvas == null) canvas = template.gameObject.AddComponent<Canvas>(); canvas.sortingLayerID = stockCanvas.sortingLayerID; I'm sure this will be helpful to someone out there too Edited April 1, 2016 by SpaceTiger added null check Link to comment Share on other sites More sharing options...
Alewx Posted April 1, 2016 Share Posted April 1, 2016 30 minutes ago, SpaceTiger said: I figured out what was causing the issue. The stock canvas is in a custom sorting layer. Since the part tools don't show us that it's not easy to find out! Easy workaround to use in your ui init : dropdown.transform.FindChild("Template").GetComponent<Canvas>().sortingLayerID = stockCanvas.sortingLayerID; I'm sure this will be helpful to someone out there too I'm sure that will be handy quite often. Link to comment Share on other sites More sharing options...
sarbian Posted April 1, 2016 Author Share Posted April 1, 2016 uh, the child has a Canvas ? I tough you only can have 1 canvas for 1 hierarchy. Or is does that dropdown menu use some distinct hierarchy to display the dropdown ? Link to comment Share on other sites More sharing options...
SpaceTiger Posted April 1, 2016 Share Posted April 1, 2016 8 minutes ago, sarbian said: uh, the child has a Canvas ? I tough you only can have 1 canvas for 1 hierarchy. Or is does that dropdown menu use some distinct hierarchy to display the dropdown ? Yeah it creates a new canvas in its child as soon as the pop up gets created. So even if you don't have one in its template it will create one for you. From a quick test you can create as many child canvases as you want there doesn't seem to be a limitation. Link to comment Share on other sites More sharing options...
sarbian Posted April 1, 2016 Author Share Posted April 1, 2016 AFAIK more Canvas means slower UI (but I guess it is the kind of slower you only notice when making phone apps) Link to comment Share on other sites More sharing options...
Ziw Posted April 1, 2016 Share Posted April 1, 2016 (edited) @sarbian I'm having troubles loading more than one Asset from AssetBundle given your method from the OP. I use this code: public void Start() { BundleDefinition bd = AssetLoader.GetBundleDefinition ("MagicSmokeIndustries/AssetBundles/infernalroboticsui"); if (bd != null) { Logger.Log ("Found IR UI Bundle Definition. Listing Assets"); foreach(var ad in bd.assets) { Logger.Log ("Found AssetDefinition:" + ad.name + ", type = " + ad.type); } } AssetLoader.LoadAssets(OnPrefabsLoaded, bd.assets.FindAll(s => s.type == "GameObject").ToArray()); } public void OnPrefabsLoaded(AssetLoader.Loader loader) { Logger.Log ("OnPrefabsLoaded was called"); for (int i = 0; i < loader.definitions.Length; i++ ) { Logger.Log ("Examining definition: " + loader.definitions[i].name + ", objects[i] = " + (loader.objects[i] ==null ? "null" : loader.objects[i].name)); if(loader.definitions[i].name == "FlightServoControlWindowPrefab" && loader.objects[i] != null) { controlWindowPrefab = loader.objects [i] as GameObject; controlWindowPrefabReady = true; Logger.Log ("Successfully loaded control window prefab"); } if(loader.definitions[i].name == "FlightControllerServoGroupLine" && loader.objects[i] != null) { controlWindowGroupLinePrefabReady = loader.objects [i] as GameObject; controlWindowGroupLinePrefabReady = true; Logger.Log ("Successfully loaded control window Group prefab"); } if(loader.definitions[i].name == "FlightControllerServoLine" && loader.objects[i] != null) { controlWindowServoLinePrefab = loader.objects [i] as GameObject; controlWindowServoLinePrefabReady = true; Logger.Log ("Successfully loaded control window Servo prefab"); } } } And the first prefabs loads perfectly, but all others have corresponding loader.objects set to null for some reason, although they list perfectly fine as Game Objects, and if I only load one of each - they work. Moreover I see some errors in log like this (although it does not seem to affect the load of the first GameObject from the Bundle) The AssetBundle 'file:///Users/stepanandreev/Library/Application Support/Steam/SteamApps/common/Kerbal Space Program/GameData/MagicSmokeIndustries/AssetBundles/infernalroboticsui.ksp' can't be loaded because another AssetBundle with the same files are already loaded Edited April 1, 2016 by Ziw Link to comment Share on other sites More sharing options...
Ziw Posted April 1, 2016 Share Posted April 1, 2016 It seems like AssetLoader only supports one GameObject per bundle, which is sad. Oh well, maybe it will save somebody else couple hours of frustration... Link to comment Share on other sites More sharing options...
linuxgurugamer Posted April 1, 2016 Share Posted April 1, 2016 5 hours ago, linuxgurugamer said: ok, but the right click on the toolbar was working in 1.0.5, and @sal_vager confirmed that it was a mistake. For now, I've changed the way the mod works a bit. I was using the right-click to bring up the setting window, and left-click to display some info. The changes I made are that the left click brings up the settings window, and the info window is now an option. This is in my TotalTime mod, but I do use the right-click on the toolbar in other mods. Re. the MultiOptionDialog, this is in KRASH (was in the old Holodeck) code. I found some examples on how to do it without using a callback, so unless I hear another way to use a callback function, I'll probably recode the dialogs @sarbian I need your example of how to do the MultiOptiondialog in 1.1. Apparently it doesn't use DialogOption any more, but instead uses DialogGUIBase? And I don't see how to move from one to the other yet. Thanks Link to comment Share on other sites More sharing options...
sarbian Posted April 1, 2016 Author Share Posted April 1, 2016 2 hours ago, linuxgurugamer said: @sarbian I need your example of how to do the MultiOptiondialog in 1.1. Apparently it doesn't use DialogOption any more, but instead uses DialogGUIBase? And I don't see how to move from one to the other yet. Thanks var dialog = new MultiOptionDialog("Message", "Title", HighLogic.UISkin,new DialogGUIBase[] { new DialogGUIButton("Yes", () => DoStuff()), new DialogGUIButton("No", () => DoOtherStuff()) }); PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), dialog, false, HighLogic.UISkin, true); Link to comment Share on other sites More sharing options...
stupid_chris Posted April 1, 2016 Share Posted April 1, 2016 1 minute ago, sarbian said: var dialog = new MultiOptionDialog("Message", "Title", HighLogic.UISkin,new DialogGUIBase[] { new DialogGUIButton("Yes", () => DoStuff()), new DialogGUIButton("No", () => DoOtherStuff()) }); PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), dialog, false, HighLogic.UISkin, true); Ninja'd. DialogGUIBase is a generic class, like PartModule. Theres a bunch of DialogGUI*** classes that do various things, and that allow callbacks. Link to comment Share on other sites More sharing options...
linuxgurugamer Posted April 1, 2016 Share Posted April 1, 2016 26 minutes ago, sarbian said: var dialog = new MultiOptionDialog("Message", "Title", HighLogic.UISkin,new DialogGUIBase[] { new DialogGUIButton("Yes", () => DoStuff()), new DialogGUIButton("No", () => DoOtherStuff()) }); PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), dialog, false, HighLogic.UISkin, true); Great, thanks a lot Link to comment Share on other sites More sharing options...
Recommended Posts