示例#1
0
 // A variation on the toggle handler that allows some extra information to be passed.
 buttonHandlerType fileToggleHandler(TreeNode n, ToggleVariable toggleVariable, string onString, string offString, fileButtonHandlerType handlerOn, fileButtonHandlerType handlerOff, Texture onIcon, Texture offIcon)
 {
     return((controller, controllerObject, button, avatar, initialize) => fileToggleButton(n, toggleVariable, onString, offString, handlerOn, handlerOff, onIcon, offIcon, controller, controllerObject, button, avatar, initialize));
 }
示例#2
0
 // Provides standard menu functions, but call a more advanced handler since the button knows more
 // information about itself.
 private void fileToggleButton(TreeNode n, ToggleVariable toggleVariable, string onString, string offString, fileButtonHandlerType handlerOn, fileButtonHandlerType handlerOff, Texture onIcon, Texture offIcon, ControlInput controller, ControlInput.ControllerDescription controllerObject, GameObject button, GameObject avatar, bool initialize = false)
 {
     if (!initialize)
     {
         toggleVariable.toggle = !toggleVariable.toggle;
     }
     if (toggleVariable.toggle)
     {
         setLabel(button, onString);
         GameObject icon = button.transform.Find("CheckOptionSymbol").gameObject;
         if (icon != null)
         {
             icon.GetComponent <MeshRenderer> ().material.mainTexture = onIcon;
         }
         if (handlerOn != null)
         {
             handlerOn(n, controller, controllerObject, button, avatar, initialize);
         }
     }
     else
     {
         setLabel(button, offString);
         GameObject icon = button.transform.Find("CheckOptionSymbol").gameObject;
         if (icon != null)
         {
             icon.GetComponent <MeshRenderer> ().material.mainTexture = offIcon;
         }
         if (handlerOff != null)
         {
             handlerOff(n, controller, controllerObject, button, avatar, initialize);
         }
     }
 }