Inheritance: FSO.Client.UI.Framework.UIContainer
Ejemplo n.º 1
0
 public void CloseEOD()
 {
     if (ActiveEOD == null) return; //???
     ShowEODMode(null);
     Remove(ActiveEOD);
     ActiveEOD = null;
     ActivePID = 0;
 }
Ejemplo n.º 2
0
        public void OnEODMessage(VMNetEODMessageCmd cmd)
        {
            switch (cmd.EventName)
            {
            case "eod_enter":
                //attempt to create the EOD UI for the given plugin (live mode will detect this)
                if (cmd.Binary)
                {
                    return;                 //???
                }
                Type handlerType = null;
                if (IDToHandler.TryGetValue(cmd.PluginID, out handlerType))
                {
                    ActiveEOD = (UIEOD)Activator.CreateInstance(handlerType, this);
                    ActivePID = cmd.PluginID;
                    Add(ActiveEOD);
                }
                break;

            case "eod_leave":
                if (cmd.Binary || ActiveEOD == null)
                {
                    return;                                      //???
                }
                DisplayMode = null;
                Remove(ActiveEOD);
                ActivePID = 0;
                ActiveEOD = null;
                break;

            default:
                //forward to existing ui
                if (ActiveEOD == null)
                {
                    return;                        //uh... what UI?
                }
                if (cmd.Binary)
                {
                    EODDirectBinaryEventHandler handle = null;
                    if (ActiveEOD.BinaryHandlers.TryGetValue(cmd.EventName, out handle))
                    {
                        handle(cmd.EventName, cmd.BinData);
                    }
                }
                else
                {
                    EODDirectPlaintextEventHandler handle = null;
                    if (ActiveEOD.PlaintextHandlers.TryGetValue(cmd.EventName, out handle))
                    {
                        handle(cmd.EventName, cmd.TextData);
                    }
                }
                break;
            }
        }
Ejemplo n.º 3
0
 public void CloseEOD()
 {
     if (ActiveEOD == null)
     {
         return;                    //???
     }
     ShowEODMode(null);
     Remove(ActiveEOD);
     ActiveEOD = null;
     ActivePID = 0;
 }
Ejemplo n.º 4
0
 public void OnEODMessage(VMNetEODMessageCmd cmd)
 {
     switch (cmd.EventName)
     {
         case "eod_enter":
             //attempt to create the EOD UI for the given plugin (live mode will detect this)
             if (cmd.Binary) return; //???
             Type handlerType = null;
             if (IDToHandler.TryGetValue(cmd.PluginID, out handlerType))
             {
                 ActiveEOD = (UIEOD)Activator.CreateInstance(handlerType, this);
                 ActivePID = cmd.PluginID;
                 Add(ActiveEOD);
             }
             break;
         case "eod_leave":
             if (cmd.Binary || ActiveEOD == null) return; //???
             DisplayMode = null;
             Remove(ActiveEOD);
             ActivePID = 0;
             ActiveEOD = null;
             break;
         default:
             //forward to existing ui
             if (ActiveEOD == null) return; //uh... what UI?
             if (cmd.Binary)
             {
                 EODDirectBinaryEventHandler handle = null;
                 if (ActiveEOD.BinaryHandlers.TryGetValue(cmd.EventName, out handle))
                 {
                     handle(cmd.EventName, cmd.BinData);
                 }
             } else
             {
                 EODDirectPlaintextEventHandler handle = null;
                 if (ActiveEOD.PlaintextHandlers.TryGetValue(cmd.EventName, out handle))
                 {
                     handle(cmd.EventName, cmd.TextData);
                 }
             }
             break;
     }
 }
Ejemplo n.º 5
0
        public void SetInEOD(EODLiveModeOpt options, UIEOD eod)
        {
            bool eodPresent = (options != null);
            bool inEOD = eodPresent && !HideEOD;
            if (ActiveEOD != null) Remove(ActiveEOD);

            LastEODConfig = options;
            ActiveEOD = eod;
            EODHelpButton.Visible = inEOD;
            EODCloseButton.Visible = inEOD;
            EODExpandButton.Visible = false; //todo
            EODContractButton.Visible = false;
            EODButton.Visible = eodPresent;

            bool tall = inEOD && options.Height == EODHeight.Tall;

            EODPanel.Visible = inEOD && !tall;
            EODPanelTall.Visible = inEOD && tall;

            EODButtonLayoutNone.Visible = inEOD && !tall && options.Buttons == 0;
            EODButtonLayoutNoneTall.Visible = inEOD && tall && options.Buttons == 0;
            EODButtonLayoutOne.Visible = inEOD && !tall && options.Buttons == 1;
            EODButtonLayoutOneTall.Visible = inEOD && tall && options.Buttons == 1;
            EODButtonLayoutTwo.Visible = inEOD && !tall && options.Buttons == 2;
            EODButtonLayoutTwoTall.Visible = inEOD && tall && options.Buttons == 2;

            EODSubFullLength.Visible = inEOD && !tall && options.Length == EODLength.Full;
            EODSubFullLengthTall.Visible = inEOD && tall && options.Length == EODLength.Full;
            EODSubMediumLength.Visible = inEOD && !tall && options.Length == EODLength.Medium;
            EODSubMediumLengthTall.Visible = inEOD && tall && options.Length == EODLength.Medium;
            EODSubShortLength.Visible = inEOD && !tall && options.Length == EODLength.Short;
            EODSubShortLengthTall.Visible = inEOD && tall && options.Length == EODLength.Short;

            EODMsgWinLong.Visible = inEOD && options.Tips == EODTextTips.Long;
            EODMsgWinShort.Visible = inEOD && options.Tips == EODTextTips.Short;
            EODTimer.Visible = inEOD && options.Timer == EODs.EODTimer.Normal;

            MsgWinTextEntry.Visible = inEOD && options.Tips != EODTextTips.None;
            TimerTextEntry.Visible = inEOD && options.Timer != EODs.EODTimer.None;

            MoodPanelButton.Position = (eodPresent) ? new Vector2(20, 7) : new Vector2(31, 63);
            if (EODImage.Texture != null) EODImage.Texture.Dispose();
            EODImage.Texture = null;

            if (inEOD)
            {
                Add(ActiveEOD);
                ActiveEOD.Position = new Vector2(120, 0);
            }

            if (eodPresent)
            {
                Vector2 TopXOffset = new Vector2();
                Vector2 MoodButtonOff = new Vector2();
                var offHeight = options.Height;
                if (HideEOD) offHeight = EODHeight.Normal;
                switch (offHeight)
                {
                    case EODHeight.Normal:
                        TopXOffset = (Vector2)Script.GetControlProperty("EODActiveOffset");
                        MoodButtonOff = TopXOffset;
                        break;
                    case EODHeight.Tall:
                        TopXOffset = (Vector2)Script.GetControlProperty("EODActiveOffset");
                        MoodButtonOff = (Vector2)Script.GetControlProperty("EODActiveOffsetTall");
                        break;
                }
                MoodPanelButton.Position += MoodButtonOff;
                EODCloseButton.Position = EODCloseBase + TopXOffset;
                EODHelpButton.Position = EODHelpBase + MoodButtonOff;

                EODButton.Position = (Vector2)Script.GetControlProperty("EODButtonPosition") + MoodButtonOff;

                var ava = SelectedAvatar;
                if (ava != null)
                {
                    var blockInfo = ava.Thread.BlockingState;
                    if (blockInfo is VMEODPluginThreadState)
                    {
                        var eodInfo = (VMEODPluginThreadState)blockInfo;
                        var entity = LotController.vm.GetObjectById(eodInfo.ObjectID);
                        if (entity is VMGameObject)
                        {
                            var objects = entity.MultitileGroup.Objects;
                            ObjectComponent[] objComps = new ObjectComponent[objects.Count];
                            for (int i = 0; i < objects.Count; i++)
                            {
                                objComps[i] = (ObjectComponent)objects[i].WorldUI;
                            }
                            var thumb = LotController.World.GetObjectThumb(objComps, entity.MultitileGroup.GetBasePositions(), GameFacade.GraphicsDevice);

                            EODImage.Texture = thumb;
                        }
                    }
                }
                if (EODImage.Texture != null)
                {
                    var imgScale = 22f / Math.Max(EODImage.Texture.Width, EODImage.Texture.Height);
                    EODImage.SetSize(EODImage.Texture.Width * imgScale, EODImage.Texture.Height * imgScale);

                    EODImage.Position = EODButton.Position + new Vector2((EODButton.Texture.Width / 4 - EODImage.Width) / 2, (EODButton.Texture.Height - EODImage.Height) / 2);
                }
            }

            this.Y = (inEOD && options.Height == EODHeight.Tall) ? 41: 61;

            Divider.Visible = !inEOD;
            MotiveDisplay.Visible = !inEOD;
            PersonGrid.Visible = !inEOD;
            MotivesLabel.Visible = !inEOD;
            PeopleListBg.Visible = !inEOD;
            PreviousPageButton.Visible = !inEOD;
            NextPageButton.Visible = !inEOD;
            Background.Visible = !inEOD;

            PersonGrid.Columns = (eodPresent || (GlobalSettings.Default.GraphicsWidth < 1024)) ?4:9;
            PersonGrid.DrawPage();
            PeopleListBg.Texture = (eodPresent && PeopleListEODBackgroundImg != null) ? PeopleListEODBackgroundImg : PeopleListBackgroundImg;
            PeopleListBg.SetSize(PeopleListBg.Texture.Width, PeopleListBg.Texture.Height);

            var small800 = (GlobalSettings.Default.GraphicsWidth < 1024) || FSOEnvironment.UIZoomFactor > 1f;
            NextPageButton.Position = (eodPresent && !small800) ? (Vector2)Script.GetControlProperty("NextPageEODButton") : DefaultNextPagePos;
            Background.Texture = (eodPresent) ? BackgroundEODImg : DefaultBGImage;
            Background.SetSize(Background.Texture.Width, Background.Texture.Height);

            UpdateThumbPosition();
        }