Ejemplo n.º 1
0
        public void Start()
        {
            if (string.IsNullOrEmpty(hatchTransform))
            {
                JUtil.LogMessage(this, "Where's my transform?");
                return;
            }
            Transform actualTransform;

            if (internalProp == null)
            {
                actualTransform = internalModel.FindModelTransform(hatchTransform);
                if (!string.IsNullOrEmpty(internalAnimation))
                {
                    intAnim = internalModel.FindModelAnimators(internalAnimation)[0];
                }
            }
            else
            {
                actualTransform = internalProp.FindModelTransform(hatchTransform);
                if (!string.IsNullOrEmpty(internalAnimation))
                {
                    intAnim = internalProp.FindModelAnimators(internalAnimation)[0];
                }
            }
            if (!string.IsNullOrEmpty(internalAnimation) && intAnim == null)
            {
                JUtil.LogErrorMessage(this, "Animation name was not found.");
            }
            // Switching to using the stock button class because right now SmarterButton can't correctly handle doubleclick.
            InternalButton.Create(actualTransform.gameObject).OnDoubleTap(new InternalButton.InternalButtonDelegate(EVAClick));
        }
Ejemplo n.º 2
0
    public Elevator(int id, int currentFloor, int numberOfFloorToServe, int startingFloor, int endingFloor)
    {
        this.id                   = id + 1;                                                                             // Elevator's Id
        this.direction            = "";                                                                                 // Direction UP/DOWN
        this.numberOfFloorToServe = numberOfFloorToServe;
        this.currentFloor         = currentFloor;                                                                       // Elevator's current floor (Position)
        this.status               = "IDLE";                                                                             // Elevator's status IDLE/MOVING
        this.queue                = new List <int>();
        this.internalButtonList   = new List <InternalButton>();
        this.door                 = "CLOSED";                               // Elevator's doors CLOSED/OPENED
        this.myCase               = 0;
        this.sameDirection        = false;                                  // Elevator's same direction true/false
        this.startingFloor        = startingFloor;                          // Elevator's starting service
        this.endingFloor          = endingFloor;                            // Elevator's ending service
        InternalButton buttonFirstFloor = new InternalButton(1, false);

        this.internalButtonList.Add(buttonFirstFloor);
        for (int i = startingFloor; i <= endingFloor; i++)
        {
            InternalButton button = new InternalButton(i, false);
            this.internalButtonList.Add(button);
        }
    }
Ejemplo n.º 3
0
        public MenuButton(
            object label,
            Action <Div> onClick = null,
            string svgIcon       = null,
            string tooltip       = null,
            object pill          = null,
            AnyTask pillTask     = null,
            Theme?pillTheme      = Theme.Empty,
            IconButton[] actions = null)
        {
            this.SetClass("menu-button");

            var button = new InternalButton(onClick, label, svgIcon, tooltip);

            this.VisualTree.Add(button);

            Control pillContainer = null;

            if (pillTask != null || pill != null)
            {
                var _pillContainer = new DumpContainer();
                pillContainer = _pillContainer.ToControl();
                this.VisualTree.Add(pillContainer);

                var formatter = new DefaultContentFormatter();

                Control Format(object content)
                {
                    return(formatter.Format(content, (c, e) =>
                    {
                        if (e)
                        {
                            return c;
                        }
                        var span = new Span(c);
                        span.AddClass("menu-button--pill");
                        if (pillTheme != null)
                        {
                            span.AddClass($"theme-{Utils.SplitCamelCase(pillTheme.ToString()).Replace(" ", "-").ToLower()}");
                        }
                        return span;
                    }));
                }

                if (pillTask != null)
                {
                    pillTask.OnResult(result => { _pillContainer.Content = Format(result); });
                }
                else
                {
                    _pillContainer.Content = Format(pill);
                }
            }

            Div divActions = null;

            if (actions != null)
            {
                divActions = new Div(
                    actions.Cast <Control>()
                    );
                divActions.SetClass("menu-button--actions");

                this.VisualTree.Add(divActions);
            }

            if (actions != null)
            {
                JavascriptHelpers.ShowOnMouseOver(this, divActions, pillContainer);
            }
        }
Ejemplo n.º 4
0
        public override void OnAwake()
        {
            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Transform[] t1 = internalProp.FindModelComponents <Transform>();
                foreach (Transform t0 in t1)
                {
                    if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
                    {
                        Debug.Log("NavUtil: found " + t0.name);
                    }
                }
            }

            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before compassObject");
            }
            compass     = internalProp.FindModelTransform(compassObject);
            compassInit = compass.transform.localRotation;

            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before brgObject");
            }
            brgBug    = internalProp.FindModelTransform(brgObject);
            brgBugInt = brgBug.transform.localRotation;

            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before locNeedleObject");
            }
            locNeedle = internalProp.FindModelTransform(locNeedleObject);

            locNeedle.parent = brgBug;

            locInit    = locNeedle.transform.localPosition;
            locInitRot = locNeedle.transform.localRotation;



            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before gsNeedleObject");
            }
            gsNeedle = internalProp.FindModelTransform(gsNeedleObject);
            gsInit   = gsNeedle.transform.localPosition;

            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before crsRotObject");
            }
            crsBug    = internalProp.FindModelTransform(crsRotObject);
            crsBugInt = crsBug.transform.localRotation;

            //UI
            crsKnob     = internalProp.FindModelTransform(crsObject);
            hdgKnob     = internalProp.FindModelTransform(hdgObject);
            crsKnobInit = crsKnob.transform.localRotation;
            hdgKnobInit = hdgKnob.transform.localRotation;

            InternalButton hdgBtn = InternalButton.Create(hdgKnob.gameObject);

            hdgBtn.OnDown(new InternalButton.InternalButtonDelegate(OnHdgBtnClick));



            InternalButton crsBtn = InternalButton.Create(crsKnob.gameObject);

            crsBtn.OnDown(new InternalButton.InternalButtonDelegate(OnCrsBtnClick));



            dme[0] = internalProp.FindModelTransform(dmeTenthsObject);
            dme[1] = internalProp.FindModelTransform(dmeOnesObject);
            dme[2] = internalProp.FindModelTransform(dmeTensObject);
            dme[3] = internalProp.FindModelTransform(dmeHundredsObject);

            dmeInt[0] = dme[0].transform.localRotation;
            dmeInt[1] = dme[1].transform.localRotation;
            dmeInt[2] = dme[2].transform.localRotation;
            dmeInt[3] = dme[3].transform.localRotation;



            if (GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Starting systems...");
            }
            if (!NavUtilLib.GlobalVariables.Settings.navAidsIsLoaded)
            {
                NavUtilLib.GlobalVariables.Settings.loadNavAids();
            }

            if (!NavUtilLib.GlobalVariables.Materials.isLoaded)
            {
                NavUtilLib.GlobalVariables.Materials.loadMaterials();
            }



            if (GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Systems started successfully!");
            }
        }
Ejemplo n.º 5
0
 public void SetUp()
 {
     m_button1 = new InternalButton();
     m_button2 = new InternalButton();
     CommandSetup();
 }