示例#1
0
        /// <summary>
        ///  Initialize. Go through the scene and find all SMVviewBase components
        ///  and assign them to their respective SMVcontrol objects.
        ///  Can be called as needed to reload all the controls and mappings if you're making
        ///  runtime changes to the UI or loading a new scene with different UI objects.
        ///  Pass true to set up a new list and new controls - typically this will only
        ///  be done once per scene. Otherwise when passing false, controls and
        ///  their values are preserved, but scene is still searched to find UI changes.
        ///  </summary>
        public void SetupForScene(bool initialize = false)
        {
            if (initialize)
            {
                controls = new SMVcontrol[Enum.GetNames(typeof(SMVmapping)).Length];
            }

            for (int i = 0; i < controls.Length; i++)
            {
                if (initialize)
                {
                    controls[i] = new SMVcontrol();
                    controls[i].Init((SMVmapping)i, onUpdateEvent);
                }
                else
                {
                    controls[i].SetupMappings();
                }
            }

            if (doDebugLogging)
            {
                DebugDump();
            }
        }
示例#2
0
 /// <summary> Init this view </summary>
 /// <param name="parent">Provide ref to the SMVcontrol that's managing this view </param>
 public void Init(SMVcontrol parent)
 {
     //Always set this in case it can change if controls are reloaded for a scene
     this.parent = parent;
     //Only init once!
     if (hasBeenInited)
     {
         return;
     }
     //Init the derived class
     InitDerived();
     hasBeenInited = true;
 }