Example #1
0
 public void HideAll(BlipType type)
 {
     foreach (var b in Blips.Where(x => x.Type == type))
     {
         b.IsEnabled = false;
     }
 }
Example #2
0
    private static void DoBlip(Object context, Color color, string text, BlipType type)
    {
#if UNITY_EDITOR
        var st = new StackTrace();
        var sf = st.GetFrame(2);

        var currentMethodName = sf.GetMethod();
        var methodname        = currentMethodName.Name;
        var file = currentMethodName.DeclaringType.ToString();

        var ust    = StackTraceUtility.ExtractStackTrace();
        var frames = ust.Split('\n');
#else
        string   file       = "";
        string   methodname = "";
        string[] frames     = new string[] { "", "", "" };
#endif
        switch (type)
        {
        case BlipType.None:
            UnityEngine.Debug.Log(ColorPad("[blip]", color) + " " + file + ":" + methodname + "\n" + text + "\n" + "[blip origin] " + frames[2] + "\n\n", context);
            break;

        case BlipType.Warning:
            UnityEngine.Debug.LogWarning(ColorPad("[blip]", color) + " " + file + ":" + methodname + "\n" + text + "\n" + "[blip origin] " + frames[2] + "\n\n", context);
            break;

        case BlipType.Error:
            UnityEngine.Debug.LogError(ColorPad("[blip]", color) + " " + file + ":" + methodname + "\n" + text + "\n" + "[blip origin] " + frames[2] + "\n\n", context);
            break;

        default:
            break;
        }
    }
    private static void DoBlip(Object context, Color color, string text, BlipType type)
    {
#if UNITY_EDITOR
        StackTrace st = new StackTrace();
        StackFrame sf = st.GetFrame(2);

        MethodBase currentMethodName = sf.GetMethod();
        string     methodname        = currentMethodName.Name;
        string     file = currentMethodName.DeclaringType.ToString();
#else
        string file       = "";
        string methodname = "";
#endif

        switch (type)
        {
        case BlipType.None:
            UnityEngine.Debug.Log(ColorPad("[blip]", color) + " " + text + " " + file + ":" + methodname, context);
            break;

        case BlipType.Warning:
            UnityEngine.Debug.LogWarning(ColorPad("[blip]", color) + " " + text + " " + file + ":" + methodname, context);
            break;

        case BlipType.Error:
            UnityEngine.Debug.LogError(ColorPad("[blip]", color) + " " + text + " " + file + ":" + methodname, context);
            break;

        default:
            break;
        }
    }
Example #4
0
        /**
         * Constructor
         *
         * @param val the code
         * @param d the description
         */
        private BlipType(int val,string d)
        {
            value = val;
            desc = d;

            BlipType[] newtypes = new BlipType[types.Length + 1];
            System.Array.Copy(types,0,newtypes,0,types.Length);
            newtypes[types.Length] = this;
            types = newtypes;
        }
Example #5
0
        /**
         * Constructor
         *
         * @param val the code
         * @param d the description
         */
        private BlipType(int val, string d)
        {
            value = val;
            desc  = d;

            BlipType[] newtypes = new BlipType[types.Length + 1];
            System.Array.Copy(types, 0, newtypes, 0, types.Length);
            newtypes[types.Length] = this;
            types = newtypes;
        }
Example #6
0
        public void CreateAndRegisterBlip(BlipType type, int index, Point coords)
        {
            CollectibleBlip blip = new CollectibleBlip()
            {
                Type = type, Index = index, Coords = coords
            };

            blip.PropertyChanged += Blip_PropertyChanged;
            Blips.Add(blip);
        }
Example #7
0
 internal BlipStoreEntry(byte[] checkSum, BlipType blipType, uint atomLength, uint referenceIndex)
     : base(2, (uint)blipType, EscherType.MSOFBTBSE, (ushort)(atomLength + 36 + 8))
 {
     m_btWin32        = (byte)blipType;
     m_btMacOS        = (byte)blipType;
     m_rgbUID         = checkSum;
     m_size           = atomLength + 8;
     m_referenceIndex = referenceIndex;
     m_cRef           = 1u;
 }
Example #8
0
        /**
         * Gets the blip type given the value
         *
         * @param val get the value
         * @return the blip type
         */
        public static BlipType getType(int val)
        {
            BlipType type = UNKNOWN;

            for (int i = 0; i < types.Length; i++)
            {
                if (types[i].value == val)
                {
                    type = types[i];
                    break;
                }
            }

            return(type);
        }
        public BlipStoreEntry(BinaryReader _reader, uint size, uint typeCode, uint version, uint instance)
            : base(_reader, size, typeCode, version, instance)
        {
            this.btWin32 = (BlipType)this.Reader.ReadByte();
            this.btMacOS = (BlipType)this.Reader.ReadByte();
            this.rgbUid  = this.Reader.ReadBytes(16);
            this.tag     = this.Reader.ReadInt16();
            this.size    = this.Reader.ReadUInt32();
            this.cRef    = this.Reader.ReadUInt32();
            this.foDelay = this.Reader.ReadUInt32();
            this.usage   = (BlipUsage)this.Reader.ReadByte();
            this.cbName  = this.Reader.ReadByte();
            this.unused2 = this.Reader.ReadByte();
            this.unused3 = this.Reader.ReadByte();

            if (this.BodySize > 0x24)
            {
                this.Blip = Record.ReadRecord(this.Reader);
            }
        }
Example #10
0
        public void PlotAll(BlipType type)
        {
            int stateArrayBase = -1;

            switch (type)
            {
            case BlipType.Package: stateArrayBase = (int)GlobalVariable.Package1Collected; break;

            case BlipType.Rampage: stateArrayBase = (int)GlobalVariable.Rampage1Passed; break;

            case BlipType.StuntJump: stateArrayBase = (int)GlobalVariable.StuntJump1Completed; break;
            }

            var b = Blips.Where(x => x.Type == type).ToArray();

            for (int i = 0; i < b.Length; i++)
            {
                int state = TheEditor.GetGlobal(stateArrayBase + i);
                b[i].IsCollected = (state != 0);
                b[i].IsEnabled   = true;
            }
        }
Example #11
0
            internal uint AddImage(Stream imageData, ImageFormat format, string imageName, int workSheetId, out uint startSPID, out ushort dgID)
            {
                EscherType    escherType    = EscherType.MSOFBTUNKNOWN;
                BlipType      blipType      = BlipType.MSOBLIPUNKNOWN;
                BlipSignature blipSignature = BlipSignature.MSOBIUNKNOWN;

                if (format.Equals(ImageFormat.Bmp))
                {
                    escherType    = EscherType.MSOFBTBLIP_DIB;
                    blipType      = BlipType.MSOBLIPDIB;
                    blipSignature = BlipSignature.MSOBIDIB;
                }
                else if (format.Equals(ImageFormat.Jpeg))
                {
                    escherType    = EscherType.MSOFBTBLIP_JPEG;
                    blipType      = BlipType.MSOBLIPJPEG;
                    blipSignature = BlipSignature.MSOBIJFIF;
                }
                else if (format.Equals(ImageFormat.Gif))
                {
                    escherType    = EscherType.MSOFBTBLIP_GIF;
                    blipType      = BlipType.MSOBLIPPNG;
                    blipSignature = BlipSignature.MSOBIPNG;
                }
                else if (format.Equals(ImageFormat.Png))
                {
                    escherType    = EscherType.MSOFBTBLIP_GIF;
                    blipType      = BlipType.MSOBLIPPNG;
                    blipSignature = BlipSignature.MSOBIPNG;
                }
                if (m_clusters == null)
                {
                    m_clusters = new Dictionary <int, ushort>();
                }
                if (m_bStoreContainer == null)
                {
                    m_bStoreContainer = new BlipStoreContainer();
                }
                if (m_imageTable == null)
                {
                    m_imageTable = new Dictionary <string, CheckSumImage>();
                }
                int           num = (int)imageData.Length;
                CheckSumImage checkSumImage;

                if (m_imageTable.ContainsKey(imageName))
                {
                    checkSumImage = m_imageTable[imageName];
                }
                else
                {
                    byte[] checkSum    = CheckSum(imageData);
                    int    streamIndex = m_bStoreContainer.GetStreamPosFromCheckSum(checkSum);
                    if (streamIndex == -1)
                    {
                        UpdateImageStreamDGC(imageName, imageData, escherType, out streamIndex);
                    }
                    checkSumImage = new CheckSumImage(checkSum, streamIndex);
                    m_imageTable.Add(imageName, checkSumImage);
                }
                if (escherType == EscherType.MSOFBTBLIP_DIB)
                {
                    num -= 14;
                    StreamList[checkSumImage.StreamIndex].Offset = 14;
                }
                uint result = AddImage(checkSumImage.CheckSum, checkSumImage.StreamIndex, num, escherType, blipType, blipSignature, workSheetId);

                dgID      = m_clusters[workSheetId];
                startSPID = m_drawingGroup.GetStartingSPID(dgID);
                return(result);
            }
Example #12
0
            internal uint AddImage(byte[] checkSum, int streamIndex, int imageLength, EscherType escherType, BlipType blipType, BlipSignature blipSignature)
            {
                if (m_bSEList == null)
                {
                    m_bSEList = new Hashtable();
                }
                string @string = Encoding.ASCII.GetString(checkSum);

                if (m_bSEList.ContainsKey(@string))
                {
                    BlipStoreEntry obj = (BlipStoreEntry)m_bSEList[@string];
                    obj.ReferenceCount++;
                    return(obj.ReferenceIndex);
                }
                if (m_blipList == null)
                {
                    m_blipList = new ArrayList();
                }
                Blip blip = new Blip(checkSum, streamIndex, imageLength, escherType, blipSignature);

                m_blipList.Add(blip);
                base.Instance = (uint)m_blipList.Count;
                BlipStoreEntry value = new BlipStoreEntry(checkSum, blipType, blip.Length, (uint)m_blipList.Count);

                m_bSEList.Add(@string, value);
                m_totalLength += 44 + imageLength + 8 + 16 + 1;
                return((uint)m_blipList.Count);
            }
Example #13
0
 /// <summary>
 /// Creates a blip from all the createBlip parameters
 /// </summary>
 public Blip(Vector3 vector, BlipType icon, Color color, int size = 2, int ordering = 0, float visibleDistance = 16383.0f)
     : this(MtaClient.CreateBlip(vector.X, vector.Y, vector.Z, (int)icon, size, color.R, color.G, color.B, color.A, ordering, visibleDistance))
 {
 }
Example #14
0
 public static Task <IBlip> CreateBlip(BlipType type, Position pos) =>
 AltVAsync.Schedule(() => Alt.CreateBlip(type, pos));
Example #15
0
 public static IBlip CreateBlip(IPlayer player, BlipType type, Position pos) =>
 Core.CreateBlip(player, (byte)type, pos);
Example #16
0
 public static IBlip CreateBlip(BlipType type, IEntity entityAttach) =>
 Module.Server.CreateBlip(null, (byte)type, entityAttach);
Example #17
0
 public static IBlip CreateBlip(BlipType type, Position pos) =>
 Module.Server.CreateBlip(null, (byte)type, pos);
Example #18
0
 public static IBlip CreateBlip(IPlayer player, BlipType type, IEntity entityAttach) =>
 Module.Server.CreateBlip(player, (byte)type, entityAttach);
Example #19
0
 public static IBlip CreateBlip(IPlayer player, BlipType type, Position pos) =>
 Module.Server.CreateBlip(player, (byte)type, pos);
Example #20
0
        private static IObstacle CreateDecorationForObject(ref IObstacle concreteObstacle)
        {
            MovementType movement = (MovementType)UnityEngine.Random.Range(0, (int)MovementType.Dynamic + 1);
            BlipType     blip     = (BlipType)UnityEngine.Random.Range(0, (int)BlipType.Delayed + 1);


            /*TODO:
             * Create better generation algorithm.
             * - Static objects should be more common
             * - Dynamic/Static ratio should increase while player continues playing.
             * - Blippers should be very common (atlesat a ratio of 3 blipper/non-blipper)
             */
            IObstacle decorated = concreteObstacle;

            switch (blip)
            {
            case BlipType.Standart:
                decorated = new BlipDecorator(decorated);
                break;

            case BlipType.Existing:
                decorated = new ExistingBlip(decorated);

                break;

            case BlipType.Delayed:
                decorated = new DelayedBlip(decorated);

                break;

            case BlipType.None:
                break;

            default:
                Debug.LogError("Impossbile Blip Decoration Randomized");
                break;
            }

            switch (movement)
            {
            case MovementType.None:

                decorated = new MovementDecorator(decorated);
                break;

            case MovementType.Static:     //Static //TODO: Disabled for now. Find a use
                //decorated = new StaticMovementDecorator(decorated);

                decorated = new MovementDecorator(decorated);
                break;

            case MovementType.Dynamic:                                                      //Dynamic

                decorated = new DynamicMovementDecorator(decorated, new Vector2(4, 4), 7f); //TODO: Change vector.zero to a meaningful path;
                break;

            default:
                Debug.LogError("Impossbile Movement Decoration Randomized");
                break;
            }
            return(decorated);
        }
Example #21
0
 public static Task <IBlip> CreateBlip(IPlayer player, BlipType type, Position pos) =>
 AltVAsync.Schedule(() => Alt.CreateBlip(player, type, pos));
Example #22
0
 /// <summary>
 /// Creates a blip from all createBlip parameters
 /// </summary>
 public Blip(Vector3 vector, BlipType icon, Color color, int size = 2, int ordering = 0, float visibleDistance = 16383.0f, Element visibleTo = null)
     : this(MtaServer.CreateBlip(vector.X, vector.Y, vector.Z, (int)icon, size, color.R, color.G, color.B, color.A, ordering, visibleDistance, visibleTo?.MTAElement))
 {
 }
Example #23
0
 public static Task <IBlip> CreateBlip(BlipType type, IEntity entityAttach) =>
 AltVAsync.Schedule(() => Alt.CreateBlip(type, entityAttach));
Example #24
0
 public static async Task <IBlip> CreateBlip(BlipType type, IEntity entityAttach) =>
 await AltVAsync.Schedule(() => Alt.CreateBlip(type, entityAttach)).ConfigureAwait(false);
Example #25
0
 public static IBlip CreateBlip(IPlayer player, BlipType type, IEntity entityAttach) =>
 Core.CreateBlip(player, (byte)type, entityAttach);
Example #26
0
 private uint AddImage(byte[] checkSum, int streamIndex, int imageLength, EscherType escherType, BlipType blipType, BlipSignature blipSignature, int workSheetId)
 {
     if (m_clusters.ContainsKey(workSheetId))
     {
         int dgID = m_clusters[workSheetId];
         m_drawingGroup.IncrementShapeCount(dgID);
     }
     else
     {
         m_clusters.Add(workSheetId, (ushort)(m_clusters.Count + 1));
         int dgID = m_clusters.Count;
         m_drawingGroup.AddCluster(dgID);
         m_drawingGroup.IncrementShapeCount(dgID);
     }
     return(m_bStoreContainer.AddImage(checkSum, streamIndex, imageLength, escherType, blipType, blipSignature));
 }
Example #27
0
 public static IBlip CreateBlip(BlipType type, Position pos) =>
 Core.CreateBlip(null, (byte)type, pos);
Example #28
0
 public static IBlip CreateBlip(BlipType type, IEntity entityAttach) =>
 Core.CreateBlip(null, (byte)type, entityAttach);
Example #29
0
 /// <summary>
 /// Creates a blip attached to an element in the world
 /// </summary>
 public Blip(PhysicalElement physicalElement, BlipType icon, Color color, int size = 2, int ordering = 0, float visibleDistance = 16383.0f, Element visibleTo = null)
     : this(MtaServer.CreateBlipAttachedTo(physicalElement.MTAElement, (int)icon, size, color.R, color.G, color.B, color.A, ordering, visibleDistance, visibleTo?.MTAElement))
 {
 }
Example #30
0
 public static async Task <IBlip> CreateBlip(BlipType type, Position pos) =>
 await AltVAsync.Schedule(() => Alt.CreateBlip(type, pos)).ConfigureAwait(false);