예제 #1
0
 public static void RemoveDecal(Decal dc)
 {
     if (AllDecals.Contains(dc))
     {
         AllDecals.Remove(dc);
     }
 }
예제 #2
0
        public static bool MargeShared(Decal Current, int count = 0)
        {
            if (count <= 0 && NewDecals != null)
            {
                count = NewDecals.Count;
            }

            bool found = false;

            for (int n = 0; n < count; n++)
            {
                if (Current.Compare(NewDecals[n]))
                {
                    Current.Shared = NewDecals[n].Shared;
                    found          = true;
                    return(false);
                }
            }
            if (!found)
            {
                Current.Shared = new Decal.DecalSharedSettings();
                Current.Shared.Load(Current);
                NewDecals.Add(Current);
                Decal.AllDecalsShared.Add(Current.Shared);
                return(true);
            }
            return(false);
        }
예제 #3
0
        public override void Awake(Scene scene)
        {
            base.Awake(scene);
            // Choose the closest left button decal to display to
            foreach (Decal item in scene.Entities.FindAll <Decal>())
            {
                //Console.WriteLine("Decal found: " + item.Name);
                if (item.Name.StartsWith("decals/" + decalPrefix, StringComparison.InvariantCulture))
                {
                    if (DistanceBetween(item, this) < DistanceBetween(associatedDecal, this))
                    {
                        associatedDecal = item;
                    }
                }
            }
            foreach (BoardController item in scene.Entities.FindAll <BoardController>())
            {
                board = item;
            }
            SwapDecal(decalPrefix + currentMode.ToString().ToLower());
            TileGrid tileGrid = GFX.FGAutotiler.GenerateBox(tileType, (int)width / 8, (int)height / 8).TileGrid; Add(new LightOcclude());

            Add(tileGrid);
            Add(new TileInterceptor(tileGrid, highPriority: true));
        }
예제 #4
0
    private void OnEnable()
    {
        string[] matGuids = AssetDatabase.FindAssets("Decal t:Material");
        for (int i = 0; i < matGuids.Length; i++)
        {
            matGuids[i] = AssetDatabase.GUIDToAssetPath(matGuids[i]);
        }

        materials.Clear();
        for (int i = 0; i < matGuids.Length; i++)
        {
            materials.Add(AssetDatabase.LoadAssetAtPath <Material>(matGuids[i]));
        }

        Decal decal = target as Decal;

        if (decal != null && materials.Count > 0)
        {
            SerializedObject so = new SerializedObject(decal);

            bool anyChanged = false;

            Material           mat     = null;
            SerializedProperty matProp = so.FindProperty("material");
            mat = matProp.objectReferenceValue as Material;
            if (mat == null)
            {
                mat = materials[0];
                matProp.objectReferenceValue = mat;
                anyChanged = true;
            }

            if (mat != null && mat.mainTexture != null)
            {
                SerializedProperty spriteProp = so.FindProperty("sprite");
                Sprite             sprite     = spriteProp.objectReferenceValue as Sprite;
                if (sprite == null)
                {
                    string   texPath = AssetDatabase.GetAssetPath(mat.mainTexture);
                    Object[] assets  = AssetDatabase.LoadAllAssetsAtPath(texPath);
                    for (int i = 0; i < assets.Length; i++)
                    {
                        sprite = assets[i] as Sprite;
                        if (sprite != null)
                        {
                            spriteProp.objectReferenceValue = sprite;
                            anyChanged = true;
                            break;
                        }
                    }
                }
            }

            if (anyChanged)
            {
                so.ApplyModifiedProperties();
                decal.BuildDecal();
            }
        }
    }
예제 #5
0
    public void GenerateDecal(Texture2D hitTexture, GameObject affectedObj)
    {
        transform.Rotate(new Vector3(0, 0, Random.Range(-180.0f, 180.0f)));

        //<<91-04-14>>
        transform.localScale *= Random.Range(0.7f, 1.5f);
        //<<\91-04-14>>

        Decal.dCount++;
        Decal decal = gameObject.GetComponent <Decal>();

        decal.affectedObjects    = new GameObject[1];
        decal.affectedObjects[0] = affectedObj;
        decal.decalMode          = DecalMode.MESH_COLLIDER;
        decal.pushDistance       = 0.08f + DecalManager.Add(gameObject);

        //decal.pushDistance = 0.019f;

        Material mat = new Material(decal.decalMaterial);

        mat.mainTexture     = hitTexture;
        decal.decalMaterial = mat;
        decal.CalculateDecal();
        decal.transform.parent = affectedObj.transform;
    }
예제 #6
0
    void CreatePrefab()
    {
        // instantiate decal
        if (obj == null)
        {
            obj = Instantiate(ThisDecal, ThisDecal.transform.position, ThisDecal.transform.rotation, this.transform);
        }
        else if (tag == "Player")
        {
            if (obj != null)
            {
                Destroy(obj);
            }
            obj = Instantiate(ThisDecal, ThisDecal.transform.position, ThisDecal.transform.rotation, this.transform);
        }

        //decal implementation!!
        decal = obj.GetComponent <Decal>();
        if (decal) //if this obj has decal script
        {
            var filter = decal.GetComponent <MeshFilter>();
            var mesh   = filter.mesh;
            if (mesh != null)
            {
                mesh.name   = "DecalMesh";
                filter.mesh = mesh;
            }
            DecalBuilder.Build(decal);
        }
    }
예제 #7
0
        public void Draw(GraphicsDevice graphics, List <Decal> decals, Matrix view, Matrix viewProjection, Matrix inverseView)
        {
            CheckForShaderChanges();

            graphics.SetVertexBuffer(_vertexBuffer);
            graphics.Indices         = _indexBufferCube;
            graphics.RasterizerState = RasterizerState.CullClockwise;
            graphics.BlendState      = _decalBlend;

            for (int index = 0; index < decals.Count; index++)
            {
                Decal decal = decals[index];

                Matrix localMatrix = decal.World;

                _paramDecalMap.SetValue(decal.Texture);
                _paramWorldView.SetValue(localMatrix * view);
                _paramWorldViewProj.SetValue(localMatrix * viewProjection);
                _paramInverseWorldView.SetValue(inverseView * decal.InverseWorld);

                _decalPass.Apply();

                graphics.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 12);
            }
        }
    private void BuildDecal(Decal decal)
    {
        MeshFilter filter = decal.GetComponent <MeshFilter>();

        if (filter == null)
        {
            filter = decal.gameObject.AddComponent <MeshFilter>();
        }
        if (decal.renderer == null)
        {
            decal.gameObject.AddComponent <MeshRenderer>();
        }
        decal.renderer.material = decal.material;

        if (decal.material == null || decal.sprite == null)
        {
            filter.mesh = null;
            return;
        }

        affectedObjects = GetAffectedObjects(decal.GetBounds(), decal.affectedLayers);
        foreach (GameObject go in affectedObjects)
        {
            DecalBuilder.BuildDecalForObject(decal, go);
        }
        DecalBuilder.Push(decal.pushDistance);

        Mesh mesh = DecalBuilder.CreateMesh();

        if (mesh != null)
        {
            mesh.name   = "DecalMesh";
            filter.mesh = mesh;
        }
    }
        public void Place(Vector3[] Positions, Quaternion[] Rotations, Vector3[] Scales)
        {
            if (Positions.Length > 0)
            {
                Undo.RegisterUndo(new UndoHistory.HistoryDecalsChange());
            }

            for (int i = 0; i < Positions.Length; i++)
            {
                GameObject NewDecalObject = Instantiate(DecalPrefab, DecalPivot);
                OzoneDecal Obj            = NewDecalObject.GetComponent <OzoneDecal>();
                Decal      component      = new Decal();
                component.Obj  = Obj;
                Obj.Dec        = component;
                Obj.Dec.Shared = DecalSettings.GetLoaded;
                Obj.tr         = NewDecalObject.transform;

                Obj.tr.localPosition = Positions[i];
                Obj.tr.localRotation = Rotations[i];
                Obj.tr.localScale    = Scales[i];

                Obj.CutOffLOD     = DecalSettingsUi.CutOff.value;
                Obj.NearCutOffLOD = DecalSettingsUi.NearCutOff.value;

                Obj.Material = component.Shared.SharedMaterial;

                Obj.Bake();

                DecalsControler.AddDecal(Obj.Dec);
            }
            UpdateTotalCount();
        }
예제 #10
0
 private void CharacterFilter_ChangePortalMode(object sender, Decal.Adapter.Wrappers.ChangePortalModeEventArgs e)
 {
     if (e.Type == this._expectedPortalEventType)
     {
         this._event.Set();
     }
 }
예제 #11
0
    private void OnPlaceDecalAction(PlaceDecalActionEvent args)
    {
        if (args.Handled)
        {
            return;
        }

        if (!_mapMan.TryFindGridAt(args.Target, out var grid))
        {
            return;
        }

        args.Handled = true;

        var coords = EntityCoordinates.FromMap(grid.GridEntityId, args.Target, EntityManager);

        if (args.Snap)
        {
            var newPos = new Vector2(
                (float)(MathF.Round(coords.X - 0.5f, MidpointRounding.AwayFromZero) + 0.5),
                (float)(MathF.Round(coords.Y - 0.5f, MidpointRounding.AwayFromZero) + 0.5)
                );
            coords = coords.WithPosition(newPos);
        }

        coords = coords.Offset(new Vector2(-0.5f, -0.5f));

        var decal = new Decal(coords.Position, args.DecalId, args.Color, Angle.FromDegrees(args.Rotation), args.ZIndex, args.Cleanable);

        RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, coords));
    }
예제 #12
0
        public override void SpawnNode(GameWorld world)
        {
            if (!world.IsPresentationEnabled)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(ImageName))
            {
                return;
            }

            decal = new Decal();

            var rw = world.Game.RenderSystem.RenderWorld;
            var ls = rw.LightSet;

            decal.DecalMatrix        = Matrix.Scaling(Width / 2, Height / 2, Depth / 2) * WorldMatrix;
            decal.DecalMatrixInverse = Matrix.Invert(decal.DecalMatrix);

            decal.Emission  = Emission;
            decal.BaseColor = new Color4(BaseColor.R / 255.0f, BaseColor.G / 255.0f, BaseColor.B / 255.0f, 1);

            decal.Metallic       = Metallic;
            decal.Roughness      = Roughness;
            decal.ImageRectangle = ls.DecalAtlas.GetNormalizedRectangleByName(ImageName);

            decal.ColorFactor     = ColorFactor;
            decal.SpecularFactor  = SpecularFactor;
            decal.NormalMapFactor = NormalMapFactor;
            decal.FalloffFactor   = FalloffFactor;

            world.Game.RenderSystem.RenderWorld.LightSet.Decals.Add(decal);
        }
예제 #13
0
    void OnSceneGUI()
    {
        Decal decal = (Decal)target;

        if (decal.transform.hasChanged)
        {
            foreach (GameObject obj in decal.subDecals)
            {
                if (obj == null)
                {
                    continue;
                }
                for (int i = 0; i < obj.transform.childCount; i++)
                {
                    if (obj.transform.GetChild(i) == null)
                    {
                        continue;
                    }
                    DestroyImmediate(obj.transform.GetChild(i).gameObject, true);
                }
                DestroyImmediate(obj, true);
            }
            decal.subDecals.Clear();
            decal.BuildDecal();
            decal.transform.hasChanged = false;
        }
        decal.Update();
    }
 public static void RemoveDecal(Decal dc)
 {
     if (Current.AllDecals.Contains(dc))
     {
         Current.AllDecals.Remove(dc);
     }
 }
예제 #15
0
    //Used to process DecalDecorator changes.
    private void OnSceneGUI()
    {
        //Selected instance.
        Decal decal = (Decal)target;

        //Will only calculate changes and process the new Decal
        //on Repaint and MouseDrag events.
        //MouseDrag will allow us to handle changes made to scene gizmos, while
        //Repaint will allow us to handle changes made to the Inspector.

        //If the user want the objects to be updated, let's do it.
        bool hasChanged = decal.HasChanged();

        if (!hasChanged && ((Event.current.type != EventType.MouseDrag && Event.current.type != EventType.Repaint) || Event.current.modifiers != 0))
        {
            return;
        }

        //On the editor, we'll use only MeshFilter.
        decal.decalMode = DecalMode.MESH_FILTER;

        if (hasChanged)
        {
            decal.ClearDecals();

            if (decal.checkAutomatically)
            {
                GetAffectedObjects(decal);
            }

            decal.CalculateDecal();

            GenerateUV(decal);
        }
    }
예제 #16
0
        static bool VirindiViewsPresent(Decal.Adapter.Wrappers.PluginHost pHost)
        {
#if VVS_REFERENCED
            System.Reflection.Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();

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

            return false;
#else
            return false;
#endif
        }
예제 #17
0
        public static Bounds GetBounds(Decal decal)
        {
            var transform = decal.transform;
            var size      = transform.lossyScale;
            var min       = -size / 2f;
            var max       = size / 2f;

            var vts = new Vector3[] {
                new Vector3(min.x, min.y, min.z),
                new Vector3(max.x, min.y, min.z),
                new Vector3(min.x, max.y, min.z),
                new Vector3(max.x, max.y, min.z),

                new Vector3(min.x, min.y, max.z),
                new Vector3(max.x, min.y, max.z),
                new Vector3(min.x, max.y, max.z),
                new Vector3(max.x, max.y, max.z),
            };

            vts = vts.Select(transform.TransformDirection).ToArray();
            min = vts.Aggregate(Vector3.Min);
            max = vts.Aggregate(Vector3.Max);

            return(new Bounds(transform.position, max - min));
        }
예제 #18
0
        private static GameObject[] Build(DecalMeshBuilder builder, Decal decal, GameObject[] targets)
        {
            MeshFilter   filter   = decal.meshFilter;
            MeshRenderer renderer = decal.meshRenderer;

            if (decal.Material == null || decal.sprite == null)
            {
                filter.mesh.Clear();
                renderer.material = null;
                return(null);
            }

            var objects = DecalUtils.GetAffectedMeshFilter(decal, targets);

            foreach (var obj in objects)
            {
                Build(builder, decal, obj);
            }
            builder.Push(PlanetMaker.instance.PushDistance);

            if (filter.mesh == null)
            {
                filter.mesh      = new Mesh();
                filter.mesh.name = "Decal";
            }

            builder.ToMesh(filter.sharedMesh);
            renderer.material = decal.Material;

            return(objects.Select(i => i.gameObject).ToArray());
        }
        private void Decal_Render(On.Celeste.Decal.orig_Render orig, Decal self)
        {
            if (Settings.SimplifiedGraphics && Settings.SimplifiedDecal)
            {
                string decalName = self.Name.ToLower().Replace("decals/", "");
                if (!SolidDecals.Contains(decalName))
                {
                    if (!DecalRegistry.RegisteredDecals.ContainsKey(decalName))
                    {
                        return;
                    }

                    object customProperties = DecalInfoCustomProperties.GetValue(DecalRegistry.RegisteredDecals[decalName]);

                    switch (customProperties)
                    {
                    case Dictionary <string, XmlAttributeCollection> dictionary when !dictionary.ContainsKey("solid"):
                    case List <KeyValuePair <string, XmlAttributeCollection> > list when list.All(pair => pair.Key != "solid"):
                        return;
                    }
                }
            }

            orig(self);
        }
예제 #20
0
파일: Player.cs 프로젝트: psmyles/GGJ2020
    // End Walk, Run State
    // -----------------

    // -----------------
    // Start Dash State
    public void BeginDashState(State prvState, State newState)
    {
        //m_Animation.Play();
        //SetCharacterFlag(CharacterFlag.eCF_ResetMoveSpeedAfterUse);
        CurrentVelocity    = new Vector3(0.0f, m_OnGroundYVelocity, 0.0f);
        m_CurrentDashSpeed = m_DefaultMoveSpeed * m_DashSpeedMultiplier;// Can be current speed.
        CurrentMoveSpeed   = m_CurrentDashSpeed;
        m_PlayerStateMachine.CanChangeState = false;
        m_CurrRunTime = m_RunTimeToDash;

        m_CurrentDecal = m_DecalsManaer.CreateDecal(DecalsManager.DecalsType.DT_Tape);

        RaycastHit rayHit;

        if (PhysicsUtils.RaycastToGround(transform.position, out rayHit))
        {
            m_LastDashDecalPointAdded = rayHit.point;
        }
        else
        {
            m_LastDashDecalPointAdded = transform.position;
        }

        m_CurrentDecal.Thickness = m_DecalThickness;
        m_CurrentDecal.AddPoint(m_LastDashDecalPointAdded + Vector3.up * m_DecalUpOffset);
        m_CurrentDecal.UpVector = transform.up;

        m_CurrDashTime = m_MaxDashTime;
        m_Animation.CrossFade("Run");

        m_PlayerHUD.ShowMeter();
    }
예제 #21
0
    private void GenerateTag(GameObject baseObject, Transform baseTransform, Material decalMaterial, float scale, ref float depth)
    {
        GameObject decalContainer = new GameObject("DecalContainer")
        {
            layer = baseObject.layer
        };
        Transform decalContainerTransform = decalContainer.transform;

        decalContainerTransform.rotation = Random.rotation;
        decalContainerTransform.SetParent(baseTransform, false);

        GameObject decalObj = new GameObject("Decal")
        {
            layer = baseObject.layer
        };
        Transform decalTransform = decalObj.transform;

        float aspectRatio = (float)decalMaterial.mainTexture.height / decalMaterial.mainTexture.width;

        decalTransform.localScale = scale * new Vector3(0.1f, 0.1f * aspectRatio, 3.0f);
        // decalTransform.position -= new Vector3(0.0f, 0.0f, 1.5f);
        decalTransform.SetParent(decalContainerTransform, false);

        Decal decal = decalObj.AddComponent <Decal>();

        decal.maxAngle     = 60;
        decal.pushDistance = depth;
        decal.material     = decalMaterial;

        DecalBuilder.BuildAndSetDirty(decal, baseObject);
        depth += 0.0001f;
    }
예제 #22
0
        public override bool OnUserCreate()
        {
            _controller = new ImGuiController(ScreenWidth(), ScreenHeight(), this);

            velocity = new vf2d(0, 0);
            offset   = new vf2d(0, 0);
            map      = new Pixel[mapWidth, mapHeight];
            intMap   = new int[mapWidth, mapHeight];
            Random rng = new Random();

            for (int y = 0; y < mapHeight; y++)
            {
                for (int x = 0; x < mapWidth; x++)
                {
                    map[x, y]    = new Pixel(x / (float)mapWidth, y / (float)mapHeight, 1f - (y / (float)mapHeight), 1f);
                    intMap[x, y] = rng.Next(20);
                }
            }
            spr = new Sprite(0, 0);
            spr.LoadFromFile("assets/spritesheet03.png");
            decal = new Decal(spr);


            mGameLayer = CreateLayer();
            EnableLayer(mGameLayer, true);
            SetLayerCustomRenderFunction(mGameLayer, DrawImGui);

            return(true);
        }
예제 #23
0
    public static void BuildDecalForObject(Decal decal, GameObject affectedObject)
    {
        Mesh affectedMesh = affectedObject.GetComponent<MeshFilter>().sharedMesh;
        if(affectedMesh == null) return;

        float maxAngle = decal.maxAngle;

        Plane right = new Plane( Vector3.right, Vector3.right/2f );
        Plane left = new Plane( -Vector3.right, -Vector3.right/2f );

        Plane top = new Plane( Vector3.up, Vector3.up/2f );
        Plane bottom = new Plane( -Vector3.up, -Vector3.up/2f );

        Plane front = new Plane( Vector3.forward, Vector3.forward/2f );
        Plane back = new Plane( -Vector3.forward, -Vector3.forward/2f );

        Vector3[] vertices = affectedMesh.vertices;
        int[] triangles = affectedMesh.triangles;
        int startVertexCount = bufVertices.Count;

        Matrix4x4 matrix = decal.transform.worldToLocalMatrix * affectedObject.transform.localToWorldMatrix;

        for(int i=0; i<triangles.Length; i+=3) {
            int i1 = triangles[i];
            int i2 = triangles[i+1];
            int i3 = triangles[i+2];

            Vector3 v1 = matrix.MultiplyPoint( vertices[i1] );
            Vector3 v2 = matrix.MultiplyPoint( vertices[i2] );
            Vector3 v3 = matrix.MultiplyPoint( vertices[i3] );

            Vector3 side1 = v2 - v1;
            Vector3 side2 = v3 - v1;
            Vector3 normal = Vector3.Cross(side1, side2).normalized;

            if( Vector3.Angle(-Vector3.forward, normal) >= maxAngle ) continue;

            DecalPolygon poly = new DecalPolygon( v1, v2, v3 );

            poly = DecalPolygon.ClipPolygon(poly, right);
            if(poly == null) continue;
            poly = DecalPolygon.ClipPolygon(poly, left);
            if(poly == null) continue;

            poly = DecalPolygon.ClipPolygon(poly, top);
            if(poly == null) continue;
            poly = DecalPolygon.ClipPolygon(poly, bottom);
            if(poly == null) continue;

            poly = DecalPolygon.ClipPolygon(poly, front);
            if(poly == null) continue;
            poly = DecalPolygon.ClipPolygon(poly, back);
            if(poly == null) continue;

            AddPolygon( poly, normal );
        }

        GenerateTexCoords(startVertexCount, decal.sprite);
    }
예제 #24
0
 public void RemoveDecal(Decal d)
 {
     m_DecalsDiffuse.Remove(d);
     m_DecalsNormals.Remove(d);
     m_DecalsSpecular.Remove(d);
     m_DecalsEmissive.Remove(d);
     m_DecalsBoth.Remove(d);
 }
예제 #25
0
        public void Load(Decal Source)
        {
            Type     = Source.Type;
            Tex1Path = Source.TexPathes[0];
            Tex2Path = Source.TexPathes[1];

            UpdateMaterial();
        }
예제 #26
0
        public void Load(Decal Source)
        {
            Type     = Source.Type;
            Tex1Path = GetGamedataFile.FixMapsPath(Source.TexPathes[0]);
            Tex2Path = GetGamedataFile.FixMapsPath(Source.TexPathes[1]);

            UpdateMaterial();
        }
예제 #27
0
    public Decal SpawnAndQueue(Decal decalPrefab, Vector3 position, Quaternion rotation, Transform parent = null)
    {
        Decal decal = Instantiate(decalPrefab, position, rotation, parent);

        Queue(decal);

        return(decal);
    }
예제 #28
0
 private static void Draw(Decal decal)
 {
     Gizmos.Color     = Color.Yellow;
     Gizmos.Transform = decal.SceneObject.WorldTransform;
     Gizmos.DrawWireCube(
         new Vector3(0.0f, 0.0f, -decal.MaxDistance * 0.5f),
         new Vector3(decal.Size.x, decal.Size.y, decal.MaxDistance) * 0.5f);
 }
예제 #29
0
        void Start()
        {
            Decal decal = DecalSystem.CreateDecalDirect(decalData);

            decal.SetTransform(location.position, location.rotation, Vector2.one);
            decal.SetData(decalData);
            decal.transform.localScale = Vector3.one;
        }
 public void AddDecal(Decal d)
 {
     RemoveDecal(d);
     if (d.m_Kind == Decal.Kind.DiffuseOnly)
     {
         m_DecalsDiffuse.Add(d);
     }
 }
예제 #31
0
        void OnEnable()
        {
            // Set data
            m_Target = target as Decal;

            // Get Properties
            m_DecalDataProp = serializedObject.FindProperty(PropertyNames.DecalData);
        }
예제 #32
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);
 }
예제 #33
0
    public void Queue(Decal decal)
    {
        queuedDecals.Add(decal);

        if (queuedDecals.Count == 1)
        {
            enabled = true;
        }
    }
예제 #34
0
    void OnSceneGUI()
    {
        Decal decal = (Decal)target;

        if (Event.current.control)
        {
            HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
        }

        if (Event.current.control && Event.current.type == EventType.MouseDown && Event.current.button == 0)
        {
            Ray        ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
            RaycastHit hit = new RaycastHit();
            if (Physics.Raycast(ray, out hit, 50))
            {
                float tmp = decal.transform.localEulerAngles.z;
                decal.transform.position = hit.point;
                decal.transform.forward  = -hit.normal;
                Vector3 t = decal.transform.localEulerAngles;
                t.z = tmp;
                decal.transform.localEulerAngles = t;
            }
        }

        Vector3 scale = decal.transform.localScale;

        if (decal.sprite != null)
        {
            float ratio = (float)decal.sprite.rect.width / decal.sprite.rect.height;
            if (oldScale.x != scale.x)
            {
                scale.y = scale.x / ratio;
            }
            else
            if (oldScale.y != scale.y)
            {
                scale.x = scale.y * ratio;
            }
            else
            if (scale.x != scale.y * ratio)
            {
                scale.x = scale.y * ratio;
            }
            decal.transform.localScale = scale;
        }

        bool hasChanged = oldMatrix != decal.transform.localToWorldMatrix;

        oldMatrix = decal.transform.localToWorldMatrix;
        oldScale  = decal.transform.localScale;


        if (hasChanged)
        {
            BuildDecal(decal);
        }
    }
 void _decalEvents_SpellCast(object sender, Decal.Adapter.Wrappers.SpellCastEventArgs e)
 {
     switch (e.SpellId)
     {
         case Data.SpellIds.LifestoneRecall:
             this.OnSelfLifestoneRecall();
             break;
     }
 }
예제 #36
0
		void CharacterFilter_Death(object sender, Decal.Adapter.Wrappers.DeathEventArgs e)
		{
			try
			{
				if (!Settings.SettingsManager.Misc.LogOutOnDeath.Value)
					return;

				CoreManager.Current.Actions.Logout();
			}
			catch (Exception ex) { Debug.LogException(ex); }
		}
예제 #37
0
		void CharacterFilter_Login(object sender, Decal.Adapter.Wrappers.LoginEventArgs e)
		{
			try
			{
				if (!Settings.SettingsManager.Misc.RemoveWindowFrame.Value)
					return;

				RemoveWindowFrame();
			}
			catch (Exception ex) { Debug.LogException(ex); }
		}
 void CoreManager_ChatBoxMessage(object sender, Decal.Adapter.ChatTextInterceptEventArgs e)
 {
     REPlugin.Instance.InvokeOperationSafely(() =>
     {
         ChatEvent chatEvent;
         if (ChatEvent.TryParse(e.Text, out chatEvent))
         {
             this.HandleChatEvent(chatEvent);
         }
     });
 }
예제 #39
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;
            }
        }
예제 #40
0
	private void GenerateUV(Decal d)
	{
		if(d.GetComponent<MeshFilter>() == null) return;
		
		Mesh m = d.GetComponent<MeshFilter>().sharedMesh;
		
		Vector2[] uv = Unwrapping.GeneratePerTriangleUV(m);
			
        MeshUtility.SetPerTriangleUV2(m, uv);

        Unwrapping.GenerateSecondaryUVSet(m);
	}
예제 #41
0
        private void ChangePortalModeCorpses(object sender, Decal.Adapter.Wrappers.ChangePortalModeEventArgs e)
        {
            try
            {
                CorpseTrackingList.Clear();
                foreach(WorldObject wo in Core.WorldFilter.GetByObjectClass(ObjectClass.Corpse))
                {
                    if(!CorpseTrackingList.Any(x => x.Id == wo.Id)){CheckCorpse(new LandscapeObject(wo));}
                }
             		UpdateCorpseHud();

            }catch(Exception ex){LogError(ex);}
        }
예제 #42
0
 void _decalEventsProxy_ChatBoxMessage(object sender, Decal.Adapter.ChatTextInterceptEventArgs e)
 {
     ICommand command;
     if (CommandHelpers.TryParse(e, out command))
     {
         switch (command.CommandType)
         {
             case CommandType.Foreign:
                 // Never eat ...Then I can't see the /f messages i'm causing...while others still can
                 Handlers.ForeignHandler.HandleCommand(command);
                 break;
         }
     }
 }
예제 #43
0
 void _decalEventsProxy_CommandLineText(object sender, Decal.Adapter.ChatParserInterceptEventArgs e)
 {
     ICommand command;
     if (CommandHelpers.TryParse(e, out command))
     {
         switch (command.CommandType)
         {
             case CommandType.RedoxExtension:
                 e.Eat = Handlers.RedoxExtensionsHandler.HandleCommand(command);
                 break;
             case CommandType.RedoxFellow:
                 e.Eat = Handlers.RedoxFellowHandler.HandleCommand(command);
                 break;
         }
     }
 }
예제 #44
0
		void CharacterFilter_Login(object sender, Decal.Adapter.Wrappers.LoginEventArgs e)
		{
			try
			{
				WindowPosition windowPosition;

				if (GetWindowPositionForThisClient(out windowPosition))
				{
					User32.RECT rect = new User32.RECT();

					User32.GetWindowRect(CoreManager.Current.Decal.Hwnd, ref rect);

					User32.MoveWindow(CoreManager.Current.Decal.Hwnd, windowPosition.X, windowPosition.Y, rect.Right - rect.Left, rect.Bottom - rect.Top, true);
				}
			}
			catch (Exception ex) { Debug.LogException(ex); }
		}
        private void DecalCore_CommandLineText(object sender, Decal.Adapter.ChatParserInterceptEventArgs e)
        {
            REWrapperPlugin.Instance.InvokeOperationSafely(() =>
            {
                if (e.Text.StartsWith(CommandPrefix_Legacy))
                {
                    var command = e.Text.Substring(CommandPrefix_Legacy.Length + 1).Trim();

                    e.Eat = this.HandleNormalCommand(command, true);
                }
                else if (e.Text.StartsWith(CommandPrefix))
                {
                    var command = e.Text.Substring(CommandPrefix.Length + 1).Trim();

                    e.Eat = this.HandleNormalCommand(command, false);
                }
            });
        }
        private void CharacterFilter_ChangePortalMode(object sender, Decal.Adapter.Wrappers.ChangePortalModeEventArgs e)
        {
            lock (this._lock)
            {
                if (this._complete)
                {
                    return;
                }

                this._complete = true;

                if (e.Type == this._expectedPortalEventType)
                {
                    this._onEventAction(this._stateTag);

                    this.CleanUpAndComplete();
                }
            }
        }
		void CharacterFilter_Login(object sender, Decal.Adapter.Wrappers.LoginEventArgs e)
		{
			try
			{
				var loginCommands = Settings.SettingsManager.AccountServerCharacter.GetOnLoginCommands(CoreManager.Current.CharacterFilter.AccountName, CoreManager.Current.CharacterFilter.Server, CoreManager.Current.CharacterFilter.Name);

				foreach (var command in loginCommands)
				{
					HudList.HudListRowAccessor newRow = loginList.AddRow();

					((HudStaticText)newRow[0]).Text = command;
					((HudPictureBox)newRow[1]).Image = 0x60028FC;
					((HudPictureBox)newRow[2]).Image = 0x60028FD;
					((HudPictureBox)newRow[3]).Image = 0x60011F8;
				}

				var loginCompleteCommands = Settings.SettingsManager.AccountServerCharacter.GetOnLoginCompleteCommands(CoreManager.Current.CharacterFilter.AccountName, CoreManager.Current.CharacterFilter.Server, CoreManager.Current.CharacterFilter.Name);

				foreach (var command in loginCompleteCommands)
				{
					HudList.HudListRowAccessor newRow = loginCompleteList.AddRow();

					((HudStaticText)newRow[0]).Text = command;
					((HudPictureBox)newRow[1]).Image = 0x60028FC;
					((HudPictureBox)newRow[2]).Image = 0x60028FD;
					((HudPictureBox)newRow[3]).Image = 0x60011F8;
				}

				var periodicCommands = Settings.SettingsManager.AccountServerCharacter.GetPeriodicCommands(CoreManager.Current.CharacterFilter.AccountName, CoreManager.Current.CharacterFilter.Server, CoreManager.Current.CharacterFilter.Name);

				foreach (var command in periodicCommands)
				{
					HudList.HudListRowAccessor newRow = periodicCommandList.AddRow();

					((HudStaticText)newRow[0]).Text = command.Command;
					((HudStaticText)newRow[1]).Text = command.Interval.TotalMinutes.ToString(CultureInfo.InvariantCulture);
					((HudStaticText)newRow[2]).Text = command.OffsetFromMidnight.TotalMinutes.ToString(CultureInfo.InvariantCulture);
					((HudPictureBox)newRow[3]).Image = 0x60011F8;
				}
			}
			catch (Exception ex) { Debug.LogException(ex); }
		}
예제 #48
0
        private void CoreManager_CommandLineText(object sender, Decal.Adapter.ChatParserInterceptEventArgs e)
        {
            REPlugin.Instance.InvokeOperationSafely(() =>
            {
                ChatEvent chatEvent;
                if (ChatEvent.TryParse(e.Text, out chatEvent))
                {
                    if (chatEvent.SourceName.Equals(this._expectedSourceName, StringComparison.InvariantCultureIgnoreCase))
                    {
                        this._tellReceivedWaitHandle.Set();

                        if (this._unhookOnMatch)
                        {
                            this._unhooked = true;
                            REPlugin.Instance.CoreManager.CommandLineText -= CoreManager_CommandLineText;
                        }
                    }
                }
            });
        }
예제 #49
0
		void CharacterFilter_Login(object sender, Decal.Adapter.Wrappers.LoginEventArgs e)
		{
			try
			{
				var commands = Settings.SettingsManager.AccountServerCharacter.GetOnLoginCommands(CoreManager.Current.CharacterFilter.AccountName, CoreManager.Current.CharacterFilter.Server, CoreManager.Current.CharacterFilter.Name);

				if (commands.Count == 0)
					return;

				if (pendingCommands.Count == 0)
					CoreManager.Current.RenderFrame += new EventHandler<EventArgs>(Current_RenderFrame);

				// This queues up a dummy command so our actions happen one frame after all the other plugins have finished Login
				pendingCommands.Enqueue(null);

				foreach (var action in commands)
					pendingCommands.Enqueue(action);
			}
			catch (Exception ex) { Debug.LogException(ex); }
		}
        private void DecalEventsProxy_ChatBoxMessage(object sender, Decal.Adapter.ChatTextInterceptEventArgs e)
        {
            if (ChatParsingUtilities.IsChat(e.Text, this._chatFilter) && ChatParsingUtilities.IsChannel(e.Text, this._channelFilter))
            {
                if (this.FilteredChatBoxMessage != null)
                {
                    this.FilteredChatBoxMessage(sender, e);
                }

                // Only try to parse if someone is listening
                if (this.FilteredAndParsedChatBoxMessage != null)
                {
                    ParsedChatTextInterceptEventArgs parsedEventArgs = null;
                    if (ParsedChatTextInterceptEventArgs.TryCreateFrom(e, out parsedEventArgs))
                    {
                        this.FilteredAndParsedChatBoxMessage(sender, parsedEventArgs);

                        e.Eat = parsedEventArgs.Eat;
                    }
                }
            }
        }
예제 #51
0
        private void ServerDispatchCombat(object sender, Decal.Adapter.NetworkMessageEventArgs e)
        {
            int iEvent = 0;
            try
            {
                if(e.Message.Type == EchoConstants.AC_APPLY_VISUALSOUND)
                {
                    OnVisualSound(e.Message);
                }
                if(e.Message.Type == EchoConstants.AC_GAME_EVENT)
                {
                    try
                    {
                        iEvent = Convert.ToInt32(e.Message["event"]);
                    }
                    catch{}
                    if(iEvent == EchoConstants.GE_UPDATE_HEALTH)
                    {
                        OnUpdateHealth(e.Message);
                    }
                    if(iEvent == EchoConstants.GE_IDENTIFY_OBJECT)
                    {
                         OnIdentCombat(e.Message);
                    }

                }
            }
            catch (Exception ex){LogError(ex);}
        }
예제 #52
0
        private void OnVisualSound(Decal.Adapter.Message pMsg)
        {
            try
            {
                if(MyCastList.Count == 0 && OtherCastList.Count == 0) {return;}

                int AnimationTarget = 0;
                try{AnimationTarget = pMsg.Value<int>(0);}catch{AnimationTarget = 0;}
                if(AnimationTarget == 0) { return;}

                if(Core.WorldFilter[AnimationTarget].ObjectClass != ObjectClass.Monster) {return;}
                if(!CombatHudMobTrackingList.Any(x => x.Id == AnimationTarget))
                {
                    CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[AnimationTarget]));
                }

                MonsterObject MobTarget = CombatHudMobTrackingList.Find(x => x.Id == AnimationTarget);

                int SpellAnimation = pMsg.Value<int>(1);
                double AnimationDuration = pMsg.Value<double>(2);

                if(MyCastList.Count > 0 && MyCastList.Any(x => x.SpellAnimation == SpellAnimation && x.SpellTargetId == AnimationTarget))
                {
                    SpellCastInfo MyCastSpell = MyCastList.Find(x => x.SpellAnimation == SpellAnimation && x.SpellTargetId == AnimationTarget);
                    int index = MobTarget.DebuffSpellList.FindIndex(x => x.SpellId == MyCastSpell.SpellCastId);

                    if(index >= 0)
                   	{
                        MobTarget.DebuffSpellList[index].SpellCastTime = DateTime.Now;
                        MobTarget.DebuffSpellList[index].SecondsRemaining = SpellIndex[MyCastSpell.SpellCastId].duration;
                   	}
                   	else
                   	{
                   		MonsterObject.DebuffSpell dbspellnew = new MonsterObject.DebuffSpell();
                   		dbspellnew.SpellId = MyCastSpell.SpellCastId;
                   		dbspellnew.SpellCastTime = DateTime.Now;
                   		dbspellnew.SecondsRemaining = SpellIndex[MyCastSpell.SpellCastId].duration;
                   		MobTarget.DebuffSpellList.Add(dbspellnew);
                   	}
                   	MyCastList.Remove(MyCastSpell);
                   	UpdateTactician();
                }

                if(OtherCastList.Count > 0 && OtherCastList.Any(x => x.Animation == SpellAnimation))
                {
                    int index_o = OtherCastList.FindIndex(x => x.Animation == SpellAnimation);

                    if(index_o >= 0)
                    {
                        OtherDebuffCastInfo OtherCastSpell = OtherCastList[index_o];
                        int index = MobTarget.DebuffSpellList.FindIndex(x => x.SpellId == OtherCastSpell.SpellId);

                        if(index >= 0)
                       	{
                            MobTarget.DebuffSpellList[index].SpellCastTime = DateTime.Now;
                            MobTarget.DebuffSpellList[index].SecondsRemaining = SpellIndex[OtherCastSpell.SpellId].duration;
                       	}
                        else
                       	{
                       		MonsterObject.DebuffSpell dbspellnew = new MonsterObject.DebuffSpell();
                       		dbspellnew.SpellId = OtherCastSpell.SpellId;
                       		dbspellnew.SpellCastTime = DateTime.Now;
                       		dbspellnew.SecondsRemaining = SpellIndex[OtherCastSpell.SpellId].duration;
                       		MobTarget.DebuffSpellList.Add(dbspellnew);
                       	}
                       	OtherCastList.Remove(OtherCastSpell);
                       	UpdateTactician();
                    }
                }

                MyCastList.RemoveAll(x => (DateTime.Now - x.CastTime).TotalSeconds > 8);
                OtherCastList.RemoveAll(x => (DateTime.Now - x.HeardTime).TotalSeconds > 8);

            }catch(Exception ex){LogError(ex);}
        }
예제 #53
0
        private void OnUpdateHealth(Decal.Adapter.Message pMsg)
        {
            try
            {
                int PossibleMobID = 0;
                try {PossibleMobID = Convert.ToInt32(pMsg["object"]);}catch{PossibleMobID = 0;}
                if(PossibleMobID == 0){return;}
                if(Core.WorldFilter[PossibleMobID].ObjectClass == ObjectClass.Monster)
                {
                    if(CombatHudMobTrackingList.Count == 0)
                    {
                        CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[PossibleMobID]));
                    }
                    else if(!CombatHudMobTrackingList.Any(x => x.Id == PossibleMobID))
                    {
                        CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[PossibleMobID]));
                    }

                    MonsterObject UpdateMonster = CombatHudMobTrackingList.First(x => x.Id == PossibleMobID);

                    UpdateMonster.HealthRemaining = Convert.ToInt32(Convert.ToDouble(pMsg["health"])*100);
                }
                UpdateTactician();
                UpdateFocusHud();
            }
            catch (Exception ex) {LogError(ex);}
        }
예제 #54
0
        private void OnIdentCombat(Decal.Adapter.Message pMsg)
        {
            try
            {
                int PossibleMobID = Convert.ToInt32(pMsg["object"]);
                if(Core.WorldFilter[PossibleMobID].ObjectClass == ObjectClass.Monster)
                {
                    if(CombatHudMobTrackingList.Count == 0)
                    {
                        CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[PossibleMobID]));
                    }
                    else if(!CombatHudMobTrackingList.Any(x => x.Id == PossibleMobID))
                    {
                        CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[PossibleMobID]));
                    }

                    MonsterObject UpdateMonster = CombatHudMobTrackingList.First(x => x.Id == PossibleMobID);

                    if((pMsg.Value<int>("flags") & 0x200) == 0x200)
                    {
                        //Empty try/catch to deal with cast not valid error.  (infrequent)
                        try
                        {
                            if(pMsg.Value<int>(22) > 0) {UpdateMonster.HealthMax = pMsg.Value<int>(22);}
              					if(pMsg.Value<int>(20) > 0) {UpdateMonster.HealthCurrent = pMsg.Value<int>(20);}
                        }catch{}
            //        				if(pMsg.Value<int>(20) > 0){CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).StaminaMax = pMsg.Value<int>(20);}
            //        				if(pMsg.Value<int>(28) > 0) {CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).StaminaCurrent = pMsg.Value<int>(28);}
            //        				if(pMsg.Value<int>(22) > 0) {CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).ManaMax = pMsg.Value<int>(22);}
            //        				if(pMsg.Value<int>(29) > 0) {CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).ManaCurrent = pMsg.Value<int>(29);}
                        if(UpdateMonster.HealthMax > 0)
                        {
                            UpdateMonster.HealthRemaining = Convert.ToInt32((double)UpdateMonster.HealthCurrent/(double)UpdateMonster.HealthMax*100);
                        }

                    }
                }
                UpdateTactician();
                UpdateFocusHud();
            }
            catch (Exception ex) {LogError(ex);}
        }
예제 #55
0
	//Get the objects that will be affected by the decal.
	private void GetAffectedObjects(Decal decal)
	{
		int affectedLayers = (int)decal.affectedLayers;
		
		decal.affectedObjects = null;
		
		if(affectedLayers == 0) return;
		
		MeshRenderer[] renderers = (MeshRenderer[])(Object.FindObjectsOfType(typeof(MeshRenderer)));

		if(renderers != null)
		{
			Bounds decalBounds = decal.bounds;

			List<GameObject> affectedObjects = new List<GameObject>();
			
			int mLength = renderers.Length;
			
			GameObject decalGO = decal.gameObject;
			GameObject auxGO;
			int cLayer;
			
			if(mLength > 0)
			{
				for(int i = 0; i < mLength; i++)
				{
					auxGO = renderers[i].gameObject;
					
					//Do not affect the projector
					if(auxGO == decalGO) continue;
					
					//Layer check.
					//-1 means everything will be affected, so we don't need to check this case.
					if(affectedLayers != -1)
					{
						cLayer = 1<<auxGO.layer;
						
						if((cLayer & affectedLayers) == 0) continue;
					}
					
					if(!decal.affectOtherDecals)
					{
						if(auxGO.GetComponent<Decal>() != null) continue;
					}
					
					if(!decal.affectInactiveRenderers)
					{
						if(!renderers[i].enabled) continue;
					}
					
					Bounds b = renderers[i].bounds;
					
					if(decalBounds.Intersects(b))
					{
						affectedObjects.Add(auxGO);
					}
				}
				
				mLength = affectedObjects.Count;
				decal.affectedObjects = new GameObject[mLength];
				
				for(int i = 0; i < mLength; i++)
				{
					decal.affectedObjects[i] = affectedObjects[i];
				}
				
				affectedObjects.Clear();
				affectedObjects = null;
				
				System.GC.Collect();
			}
		}
	}
예제 #56
0
	private void DrawAffectedObjects(Decal decal)
	{
		GUILayout.BeginHorizontal();
		GUILayout.Space(15);
		
		GUILayout.BeginVertical();
		
		GUILayout.BeginHorizontal();
		GUILayout.Label("Check Automatically");
		GUILayout.Space(60);
		decal.checkAutomatically = GUILayout.Toggle(decal.checkAutomatically, "");
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();

		decal.showObjects = EditorGUILayout.Foldout(decal.showObjects, "Affected Objects");
		
		if(decal.showObjects)
		{
			GUILayout.BeginHorizontal();
			GUILayout.Space(45);
			GUILayout.BeginVertical();
			
			GUILayout.BeginHorizontal();
			GUILayout.Label("Size");
			GUILayout.Space(60);
			
			int size = 0;
			
			if(decal.affectedObjects != null)
			{
				size = decal.affectedObjects.Length;
			}
			
			if(!decal.checkAutomatically)
			{
				size = Mathf.Max(EditorGUILayout.IntField(size), 0);
				
				if(size > 0 && decal.affectedObjects == null)
				{
					decal.affectedObjects = new GameObject[size];
				}
				else if(decal.affectedObjects != null && size != decal.affectedObjects.Length)
				{
					if(size == 0)
					{
						decal.affectedObjects = null;
					}
					else if(decal.affectedObjects.Length > 0)
					{
						GameObject[] objs = new GameObject[decal.affectedObjects.Length];
						for(int i = 0; i < objs.Length; i++)
						{
							objs[i] = decal.affectedObjects[i];
						}
						
						decal.affectedObjects = new GameObject[size];
						
						for(int i = 0; i < size; i++)
						{
							if(i < objs.Length)
							{
								decal.affectedObjects[i] = objs[i];
							}
							else
							{
								decal.affectedObjects[i] = objs[objs.Length - 1];
							}
						}
					}
					else
					{
						decal.affectedObjects = new GameObject[size];
					}
				}
			}
			else
			{
				GUILayout.Label(size.ToString());
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			
			GUILayout.BeginVertical();
			
			for(int i = 0; i < size; i++)
			{
				GUILayout.BeginHorizontal();
				GUILayout.Label("Element " + i.ToString());
				GUILayout.Space(30);
				if(!decal.checkAutomatically)
				{
					decal.affectedObjects[i] = (GameObject)EditorGUILayout.ObjectField(decal.affectedObjects[i], typeof(GameObject), true);
				}
				else
				{
					EditorGUILayout.ObjectField(decal.affectedObjects[i], typeof(GameObject), true);
				}
				GUILayout.EndHorizontal();
			}
			GUILayout.EndVertical();

			GUILayout.EndVertical();
			
			GUILayout.EndHorizontal();
		}
		GUILayout.EndVertical();
		
		GUILayout.EndHorizontal();
	}	
예제 #57
0
        private string GoGetArmorSpells(Decal.Adapter.Wrappers.WorldObject o)
        {
            FileService fs = (FileService)Core.FileService;
            int intspellcnt = o.SpellCount;
            string oXmlSpells = String.Empty;
            for (int i = 0; i < intspellcnt; i++)
            {
                int spellId = o.Spell(i);

                Spell spell = fs.SpellTable.GetById(spellId);

                string spellName = spell.Name;
                if (spellName.Contains("Legendary") || spellName.Contains("Epic") ||
                  spellName.Contains("Incantation") || spellName.Contains("Surge")
                    || spellName.Contains("Cloaked in Skill"))
                {
                    oXmlSpells = oXmlSpells + "," + spellName;
                }

                else
                    if (spellName.Contains("Major")) { oXmlSpells = oXmlSpells + ", " + spellName; }
            }
            if (oXmlSpells.Length > 0)
            {
                if (oXmlSpells.Substring(0, 1) == ",") { return oXmlSpells.Substring(1); }
                else { return oXmlSpells; }
            }
            else { return ""; }
        }
예제 #58
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));
                }
            }
        }
예제 #59
0
 static IView CreateMyHudViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
 {
     IView ret = new VirindiViewServiceHudControls.View();
     ret.InitializeRawXML(pHost, pXML);
     return ret;
 }
예제 #60
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;
        }