View Single Post
  #7  
Unread 01-24-2012, 07:41 AM
Digital_Utopia's Avatar
Digital_Utopia Digital_Utopia is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 207
Code:
self.KeyDown = function(sender,args)
		if (args.Action == 268435579)then
			if(self.doLayout==true)then
				self.doLayout=false;
				self.positionMode();
				self.posWindow:SetVisible(false);
			else
				self.doLayout=true;
				if(self.hideUI==false)then
				self.positionMode();
				self.posWindow:SetVisible(true);
				end
			end
		end
		if (args.Action == 268435635)then
			
			if(self.hideUI==true)then
				self.hideUI=false;
				self.hidingUI();
				if(self.onlyInCombat==false)then
					self:SetVisibility("visible");
				elseif(self.onlyInCombat==true and self.inCombat==true)then
					self:SetVisibility("visible");
				end
				if(self.doLayout==true)then
					self.positionMode();
					self.posWindow:SetVisible(true);
				end
				if(self.showDebuffBar==true)then
				self.dbb:SetVisible(true);
				end
			else
				self.hideUI=true;
				self.hidingUI();
				self:SetVisibility("hidden");
				self.posWindow:SetVisible(false);
				self.dbb:SetVisible(false);
				
			end
		end
	end
This is the chunk of code that Palantir uses to respond to layout mode (ctrl+\) and respond to hiding the UI (F12). Some of it is pretty ugly admittedly, but in essence, action 268435579 is the "action" for entering/exiting layout mode, and action 268435635 is the action for hiding/showing the UI. The general idea here was for Palantir to act as closely as possible to real UI elements, but there was some added complexity due to the ability to show/hide Palantir based on combat criteria.

There is one, potentially huge, caveat. In Lua we lack the ability to determine whether or not the player is actually in UI positioning mode, or actually has the UI hidden or not. All we can do is react to the action. While it's very unlikely, if not impossible for someone to load a plugin while their UI is hidden, the same can't be said for positioning mode. In that case, you'd end up with the annoying situation where the plugin's positioning mode would be opposite of the rest of the UI elements, so some care is required by the player.
__________________

Lord of the Rings Online
75 Fourohfour | 75 Artemedis | 60 Whiskeytango Foxtrot | 50 Mistah Boombastic | 56 Appetizer | 25 Aggromi
61 Onepointtwentyone Gigawatts


World of Warcraft
90 Downlo 85 Gravetaxi 85 Ümad 85 Artemedis 85 Guthuros
Reply With Quote