示例#1
0
        static IView CreateDecalViewResource(Decal.Adapter.Wrappers.PluginHost pHost, string pXMLResource)
        {
            IView ret = new DecalControls.View();

            ret.Initialize(pHost, pXMLResource);
            return(ret);
        }
        //Must be called by the inherited constructor
        protected bool ShowView(Decal.Adapter.Wrappers.PluginHost H)
        {
            if (MyDialogContainer.DialogExists(iDialogKey))
            {
                disp = true;
                GC.SuppressFinalize(this);
                return(false);
            }

            MyDialogContainer.Initialize();
            MyDialogContainer.AddDialog(iDialogKey, this, Dispose);
            View         = ViewSystemSelector.CreateViewXML(H, GetDialogXML());
            View.Visible = true;

            //Center view
            System.Drawing.Rectangle wnd = H.Actions.RegionWindow;
            int x = (wnd.Width - View.Size.Width) / 2;
            int y = (wnd.Height - View.Size.Height) / 2;

            View.Location = new System.Drawing.Point(x, y);

#if VVS_REFERENCED
            if (View.ViewType == ViewSystemSelector.eViewSystem.VirindiViewService)
            {
                SetVVSProps();
            }
#endif

            return(true);
        }
示例#3
0
        public static bool VirindiViewsPresent(Decal.Adapter.Wrappers.PluginHost pHost, Version minver)
        {
#if VVS_REFERENCED
            System.Reflection.Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();

            foreach (System.Reflection.Assembly a in asms)
            {
                AssemblyName nm = a.GetName();
                if ((nm.Name == "VirindiViewService") && (nm.Version >= minver))
                {
                    try
                    {
                        return(Curtain_VVS_Running());
                    }
                    catch
                    {
                        return(false);
                    }
                }
            }

            return(false);
#else
            return(false);
#endif
        }
示例#4
0
        static IView CreateMyHudViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
        {
            IView ret = new VirindiViewServiceHudControls.View();

            ret.InitializeRawXML(pHost, pXML);
            return(ret);
        }
示例#5
0
        public RenderHookWrapper(Decal.Adapter.Wrappers.PluginHost Host)
        {
            bool Is_Direct3D9_Container = false;

            try
            {
                if (string.Compare(System.Diagnostics.Process.GetCurrentProcess().ProcessName, "Direct3D9_Container", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    Is_Direct3D9_Container = true;
                }
            }
            catch { }

            //Attempting to hook while running in the d3d container rather than AC will cause a crash.
            if (!Is_Direct3D9_Container)
            {
                iRenderHook = new RenderHookLib.SVRenderHookClass();

                //Init renderhook
                object netsvc = Host.Decal.GetObject("services\\DecalNet.NetService", "{AA405035-E001-4CC3-B43A-156206843D64}");
                iRenderHook.Init(netsvc);
                Marshal.ReleaseComObject(netsvc);
                netsvc = null;

                iRenderHook.fEnabled = false;
                LightColor           = iLightColor;
                SlopeColor           = iSlopeColor;
                WaterColor           = iWaterColor;
            }
        }
示例#6
0
        public MyDialog_StringQuery(Decal.Adapter.Wrappers.PluginHost H, string[] pbuttons, string ptitle, string plabel, int picon, delInputVerify pVerify, string pdefaultinput, string dialogkey, IView pOrigin)
            : base(dialogkey, pOrigin)
        {
            iButtons      = pbuttons;
            iTitle        = ptitle;
            iLabel        = plabel;
            iIcon         = picon;
            iVerify       = pVerify;
            iDefaultInput = pdefaultinput;

            if (!base.ShowView(H))
            {
                return;
            }

            ResultButtons = new IButton[iButtons.Length];
            for (int i = 0; i < iButtons.Length; ++i)
            {
                ResultButtons[i]      = (IButton)View["btn" + i.ToString()];
                ResultButtons[i].Hit += new EventHandler(MyDialog_StringQuery_Hit);
            }
            Text       = (ITextBox)View["Textbox1"];
            Text.Text  = iDefaultInput;
            Label      = (IStaticText)View["Label1"];
            Label.Text = iLabel;

#if VVS_REFERENCED
            if (View.ViewType == ViewSystemSelector.eViewSystem.VirindiViewService)
            {
                SetStrVVSProps();
            }
#endif
        }
示例#7
0
        static IView CreateDecalViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
        {
            IView ret = new DecalControls.View();

            ret.InitializeRawXML(pHost, pXML);
            return(ret);
        }
示例#8
0
        public void InitializeRawXML(Decal.Adapter.Wrappers.PluginHost p, string pXML, string pWindowKey)
        {
            VirindiViewService.XMLParsers.Decal3XMLParser ps = new VirindiViewService.XMLParsers.Decal3XMLParser();
            ViewProperties iprop;
            ControlGroup   igroup;

            ps.Parse(pXML, out iprop, out igroup);
            myView = new VirindiViewService.HudView(iprop, igroup, pWindowKey);
        }
示例#9
0
        protected override void Shutdown()
        {
            //Stop view components
            mainview.Dispose();

            //Stop plugin logic components
            objecttracker.Dispose();

            host = null;
        }
示例#10
0
        protected override void Startup()
        {
            host = Host;

            //Start plugin logic components
            objecttracker = new Logic.ObjectTracker();

            //Start view components
            mainview = new Views.MainView();
        }
示例#11
0
 protected override void Shutdown()
 {
     try
     {
         MainView.ViewDestroy();
         MyHost = null;
     }
     catch
     {
     }
 }
示例#12
0
        ///////////////////////////////CreateViewXML///////////////////////////////

        public static IView CreateViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
        {
#if VVS_REFERENCED
            if (IsPresent(pHost, eViewSystem.VirindiViewService))
            {
                return(CreateViewXML(pHost, pXML, eViewSystem.VirindiViewService));
            }
            else
#endif
            return(CreateViewXML(pHost, pXML, eViewSystem.DecalInject));
        }
示例#13
0
        public MyDialog_ColorQuery(Decal.Adapter.Wrappers.PluginHost H, string[] pbuttons, string ptitle, string plabel, int picon, Color pdefaultinput, string dialogkey, IView pOrigin)
            : base(dialogkey, pOrigin)
        {
            iButtons      = pbuttons;
            iTitle        = ptitle;
            iLabel        = plabel;
            iIcon         = picon;
            iDefaultInput = pdefaultinput;

            if (!base.ShowView(H))
            {
                return;
            }

            ResultButtons = new IButton[iButtons.Length];
            for (int i = 0; i < iButtons.Length; ++i)
            {
                ResultButtons[i]      = (IButton)View["btn" + i.ToString()];
                ResultButtons[i].Hit += new EventHandler(MyDialog_ColorQuery_Hit);
            }
            Label      = (IStaticText)View["Label1"];
            Label.Text = iLabel;

            //Set up input boxes
            slA = (ISlider)View["slA"];
            slR = (ISlider)View["slR"];
            slG = (ISlider)View["slG"];
            slB = (ISlider)View["slB"];

            slA.Position = iDefaultInput.A;
            slR.Position = iDefaultInput.R;
            slG.Position = iDefaultInput.G;
            slB.Position = iDefaultInput.B;

            slA.Change += new EventHandler <MVIndexChangeEventArgs>(ChangedSlider);
            slR.Change += new EventHandler <MVIndexChangeEventArgs>(ChangedSlider);
            slG.Change += new EventHandler <MVIndexChangeEventArgs>(ChangedSlider);
            slB.Change += new EventHandler <MVIndexChangeEventArgs>(ChangedSlider);

#if VVS_REFERENCED
            if (VVSColorBox)
            {
                //Create the VVS colorbox
                Curtain_CreateVVSColorBox();
            }
#endif
            if (!VVSColorBox)
            {
                dColorBox           = (Decal.Adapter.Wrappers.PushButtonWrapper)(((MyClasses.MetaViewWrappers.DecalControls.View)View).Underlying.Controls["ColorBox"]);
                dColorBox.FaceColor = iDefaultInput;
            }
        }
示例#14
0
        protected override void Shutdown()
        {
            try
            {
                MainView.ViewDestroy();
                models = null;
            }
            catch (Exception ex)
            {
                LogError(ex);
            }

            MyHost = null;
        }
示例#15
0
        ///////////////////////////////System presence detection///////////////////////////////

        public static bool IsPresent(Decal.Adapter.Wrappers.PluginHost pHost, eViewSystem VSystem)
        {
            switch (VSystem)
            {
            case eViewSystem.DecalInject:
                return(true);

            case eViewSystem.VirindiViewService:
                return(VirindiViewsPresent(pHost));

            default:
                return(false);
            }
        }
示例#16
0
        ///////////////////////////////HasChatOpen///////////////////////////////

        public static bool AnySystemHasChatOpen(Decal.Adapter.Wrappers.PluginHost pHost)
        {
            if (IsPresent(pHost, eViewSystem.VirindiViewService))
            {
                if (HasChatOpen_VirindiViews())
                {
                    return(true);
                }
            }
            if (pHost.Actions.ChatState)
            {
                return(true);
            }
            return(false);
        }
示例#17
0
        protected override void Startup()
        {
            log_path = Path.ToString() + "\\error.txt";
            MyHost   = Host;

            // Init views etc
            try
            {
                // Load data

                models = LoadModels();

                // Set up views
                MainView.ViewInit();
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }
示例#18
0
        public static IView CreateViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML, eViewSystem VSystem)
        {
            if (!IsPresent(pHost, VSystem))
            {
                return(null);
            }
            switch (VSystem)
            {
            case eViewSystem.DecalInject:
                return(CreateDecalViewXML(pHost, pXML));

            case eViewSystem.VirindiViewService:
#if VVS_REFERENCED
                return(CreateMyHudViewXML(pHost, pXML));
#else
                break;
#endif
            }
            return(null);
        }
示例#19
0
        public MyDialog_MessageBox(Decal.Adapter.Wrappers.PluginHost H, string[] pbuttons, string ptitle, string plabel, int picon, string dialogkey, IView pOrigin)
            : base(dialogkey, pOrigin)
        {
            iButtons = pbuttons;
            iTitle   = ptitle;
            iLabel   = plabel;
            iIcon    = picon;

            if (!base.ShowView(H))
            {
                return;
            }

            ResultButtons = new IButton[iButtons.Length];
            for (int i = 0; i < iButtons.Length; ++i)
            {
                ResultButtons[i]      = (IButton)View["btn" + i.ToString()];
                ResultButtons[i].Hit += new EventHandler(MyDialog_MB_Hit);
            }

            Label      = (IStaticText)View["Label1"];
            Label.Text = iLabel;
        }
示例#20
0
        public static void WireupStart(object ViewObj, Decal.Adapter.Wrappers.PluginHost Host)
        {
            if (VInfo.ContainsKey(ViewObj))
            {
                WireupEnd(ViewObj);
            }
            ViewObjectInfo info = new ViewObjectInfo();

            VInfo[ViewObj] = info;

            Type ObjType = ViewObj.GetType();

            //Start views
            object[] viewattrs = ObjType.GetCustomAttributes(typeof(MVViewAttribute), true);
            foreach (MVViewAttribute a in viewattrs)
            {
                info.Views.Add(MyClasses.MetaViewWrappers.ViewSystemSelector.CreateViewResource(Host, a.Resource));
            }

            //Wire up control references
            foreach (FieldInfo fi in ObjType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy))
            {
                if (Attribute.IsDefined(fi, typeof(MVControlReferenceAttribute)))
                {
                    MVControlReferenceAttribute attr      = (MVControlReferenceAttribute)Attribute.GetCustomAttribute(fi, typeof(MVControlReferenceAttribute));
                    MetaViewWrappers.IControl   mycontrol = null;

                    //Try each view
                    foreach (MyClasses.MetaViewWrappers.IView v in info.Views)
                    {
                        try
                        {
                            mycontrol = v[attr.Control];
                        }
                        catch { }
                        if (mycontrol != null)
                        {
                            break;
                        }
                    }

                    if (mycontrol == null)
                    {
                        throw new Exception("Invalid control reference \"" + attr.Control + "\"");
                    }

                    if (!fi.FieldType.IsAssignableFrom(mycontrol.GetType()))
                    {
                        throw new Exception("Control reference \"" + attr.Control + "\" is of wrong type");
                    }

                    fi.SetValue(ViewObj, mycontrol);
                }
                else if (Attribute.IsDefined(fi, typeof(MVControlReferenceArrayAttribute)))
                {
                    MVControlReferenceArrayAttribute attr = (MVControlReferenceArrayAttribute)Attribute.GetCustomAttribute(fi, typeof(MVControlReferenceArrayAttribute));

                    //Only do the first view
                    if (info.Views.Count == 0)
                    {
                        throw new Exception("No views to which a control reference can attach");
                    }

                    Array controls = Array.CreateInstance(fi.FieldType.GetElementType(), attr.Controls.Count);

                    IView view = info.Views[0];
                    for (int i = 0; i < attr.Controls.Count; ++i)
                    {
                        controls.SetValue(view[attr.Controls[i]], i);
                    }

                    fi.SetValue(ViewObj, controls);
                }
            }

            //Wire up events
            foreach (MethodInfo mi in ObjType.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy))
            {
                if (!Attribute.IsDefined(mi, typeof(MVControlEventAttribute)))
                {
                    continue;
                }
                Attribute[] attrs = Attribute.GetCustomAttributes(mi, typeof(MVControlEventAttribute));

                foreach (MVControlEventAttribute attr in attrs)
                {
                    MetaViewWrappers.IControl mycontrol = null;
                    //Try each view
                    foreach (MyClasses.MetaViewWrappers.IView v in info.Views)
                    {
                        try
                        {
                            mycontrol = v[attr.Control];
                        }
                        catch { }
                        if (mycontrol != null)
                        {
                            break;
                        }
                    }

                    if (mycontrol == null)
                    {
                        throw new Exception("Invalid control reference \"" + attr.Control + "\"");
                    }

                    EventInfo ei = mycontrol.GetType().GetEvent(attr.EventName);
                    ei.AddEventHandler(mycontrol, Delegate.CreateDelegate(ei.EventHandlerType, ViewObj, mi.Name));
                }
            }
        }
示例#21
0
 protected override void Startup()
 {
     MyHost = Host;
     MyCore = Core;
     MainView.ViewInit();
 }
示例#22
0
 public void Initialize(Decal.Adapter.Wrappers.PluginHost p, string pXML)
 {
     myView = p.LoadViewResource(pXML);
 }
示例#23
0
 public void InitializeRawXML(Decal.Adapter.Wrappers.PluginHost p, string pXML, string pWindowKey)
 {
     myView = p.LoadView(pXML);
 }
示例#24
0
        protected override void Startup()
        {
            log_path = Path.ToString() + "\\error.txt";
            MyHost   = Host;

            // Init views etc
            try
            {
                // Load data

                models = LoadModels();
                towns  = new List <string>()
                {
                    "Aerlinthe Island",
                    "Ahurenga",
                    "Al-Arqas",
                    "Al-Jalima",
                    "Arwic",
                    "Ayan Baqur",
                    "Baishi",
                    "Bandit Castle",
                    "Beach Fort",
                    "Bluespire",
                    "Candeth Keep",
                    "Cragstone",
                    "Mt Esper-Crater Village",
                    "Danby's Outpost",
                    "Dryreach",
                    "Eastham",
                    "Fort Tethana",
                    "Glenden Wood",
                    "Greenspire",
                    "Hebian-to",
                    "Holtburg",
                    "Kara",
                    "Khayyaban",
                    "Kryst",
                    "Lin",
                    "Linvak Tukal",
                    "Lytelthorpe",
                    "MacNiall's Freehold",
                    "Mayoi",
                    "Nanto",
                    "Neydisa",
                    "Oolutanga's Refuge",
                    "Plateau Village",
                    "Qalaba'r",
                    "Redspire",
                    "Rithwic",
                    "Samsur",
                    "Sawato",
                    "Shoushi",
                    "Singularity Caul Island",
                    "Stonehold",
                    "Timaru",
                    "Tou-Tou",
                    "Tufa",
                    "Underground City",
                    "Uziz",
                    "Wai Jhou",
                    "Xarabydun",
                    "Yanshi",
                    "Yaraq",
                    "Zaikhal",
                    "Picture Room 1",
                    "Cheese Room",
                    "Picture Room 2",
                    "Campfire room",
                    "Picture Room 3",
                    "AdminLS",
                    "Shadow Spire"
                };

                // Set up views
                MainView.ViewInit();
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }