Пример #1
0
 public override int GetHashCode() {
     var hash = new MadHashCode();
     hash.Add(spriteGUID);
     hash.Add(color);
     
     return hash.GetHashCode();
 }
Пример #2
0
        public override int GetHashCode()
        {
            var hash = new MadHashCode();

            hash.Add(texture);
            hash.Add(color);

            return(hash.GetHashCode());
        }
Пример #3
0
    private bool RebuildNeeded() {
        if (iconImages.Count == 0 && spriteIcon != null && repeatCount != 0) {
            return true;
        }

        if (iconImages.Count > 0 && iconImages[0] == null) {
            // this can happen when user executes a undo operation
            return true;
        }

        int ch = MadHashCode.FirstPrime;
        ch = MadHashCode.Add(ch, spriteIcon);
        ch = MadHashCode.Add(ch, spriteSlot);
        ch = MadHashCode.Add(ch, repeatCount);
        ch = MadHashCode.Add(ch, repeatPositionDelta);
        ch = MadHashCode.Add(ch, rectTransform.pivot);

        if (ch != lastRebuildHash || dirty) {
            lastRebuildHash = ch;
            dirty = false;
            return true;
        } else {
            return false;
        }
    }
Пример #4
0
    protected string LabelFormatResolve(string format)
    {
        int hash = MadHashCode.FirstPrime;

        hash = MadHashCode.Add(hash, format);
        hash = MadHashCode.Add(hash, energyBar.valueCurrent);
        hash = MadHashCode.Add(hash, energyBar.valueMin);
        hash = MadHashCode.Add(hash, energyBar.valueMax);
        hash = MadHashCode.Add(hash, energyBar.ValueF);

        if (labelCacheParamsHash == hash)
        {
            return(labelCache);
        }

        format = format.Replace("{cur}", "" + energyBar.valueCurrent);
        format = format.Replace("{min}", "" + energyBar.valueMin);
        format = format.Replace("{max}", "" + energyBar.valueMax);
        format = format.Replace("{cur%}", string.Format("{0:00}", energyBar.ValueF * 100));
        format = format.Replace("{cur2%}", string.Format("{0:00.0}", energyBar.ValueF * 100));
        try {
            format = string.Format(format, energyBar.valueCurrent, energyBar.valueMin,
                                   energyBar.valueMax, energyBar.ValueF, energyBar.ValueF * 100);
        } catch (IndexOutOfRangeException) {
            // ignore
        } catch (FormatException) {
            // ignore
        }

        labelCache           = format;
        labelCacheParamsHash = hash;

        return(format);
    }
Пример #5
0
        private bool RebuildNeeded()
        {
            int ch = MadHashCode.FirstPrime;

            ch = MadHashCode.Add(ch, BuildVersion);
            ch = MadHashCode.Add(ch, spriteObject != null ? spriteObject.GetHashCode() : 0);
            ch = MadHashCode.AddList(ch, spritesBackground);
            ch = MadHashCode.AddList(ch, spritesForeground);
            ch = MadHashCode.Add(ch, spriteObjectPivot);
            ch = MadHashCode.Add(ch, label);
            ch = MadHashCode.Add(ch, effectBurn);
            ch = MadHashCode.Add(ch, effectBurnSprite);
            ch = MadHashCode.Add(ch, rectTransform.pivot);

            if (ch != lastRebuildHash || dirty)
            {
                lastRebuildHash = ch;
                dirty           = false;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
        public override int GetHashCode() {
            int ch = MadHashCode.FirstPrime;

            ch = MadHashCode.Add(ch, spriteGUID);
            ch = MadHashCode.Add(ch, color);

            return ch;
        }
Пример #7
0
        public override int GetHashCode() {
            int ch = MadHashCode.FirstPrime;

            ch = MadHashCode.Add(ch, sprite != null ? sprite.GetInstanceID() : 0);
            ch = MadHashCode.Add(ch, material != null ? material.GetInstanceID() : 0);
            ch = MadHashCode.Add(ch, color);

            return ch;
        }
Пример #8
0
    protected static int HashAddTexture(int current, Texture texture)
    {
#if UNITY_EDITOR
        string path = AssetDatabase.GetAssetPath(texture);
        string guid = AssetDatabase.AssetPathToGUID(path);
        return(MadHashCode.Add(current, guid));
#else
        return(MadHashCode.Add(current, texture));
#endif
    }
Пример #9
0
 protected static int HashAdd(int current, UnityEngine.Object obj)
 {
     if (obj != null)
     {
         return(MadHashCode.Add(current, obj.GetInstanceID()));
     }
     else
     {
         return(MadHashCode.Add(current, null));
     }
 }
Пример #10
0
        private bool RebuildNeeded()
        {
            int ch = MadHashCode.FirstPrime;

            ch = MadHashCode.Add(ch, spriteBar != null ? spriteBar.GetInstanceID() : 0);
            ch = MadHashCode.Add(ch, spriteBarMaterial != null ? spriteBarMaterial.GetInstanceID() : 0);
            ch = MadHashCode.AddList(ch, spritesBackground);
            ch = MadHashCode.AddList(ch, spritesForeground);
            ch = MadHashCode.Add(ch, (int)spriteBarColorType);
            ch = MadHashCode.Add(ch, (int)growDirection);
            ch = MadHashCode.Add(ch, label);
            ch = MadHashCode.Add(ch, effectBurn);
            ch = MadHashCode.Add(ch, effectBurnSprite);
            ch = MadHashCode.Add(ch, rectTransform.pivot);
            ch = MadHashCode.Add(ch, effectTiled);
            ch = MadHashCode.Add(ch, effectTiledSprite);

            ch = MadHashCode.Add(ch, barImageRepeater); // Cipsoft change

            //ch = HashAdd(ch, panel);
            //ch = HashAdd(ch, textureMode);
            //ch = HashAddArray(ch, texturesBackground);
            //ch = HashAddTexture(ch, textureBar);
            //ch = HashAddArray(ch, texturesForeground);
            //ch = HashAdd(ch, atlas);
            //ch = HashAddArray(ch, atlasTexturesBackground);
            //ch = HashAdd(ch, atlasTextureBarGUID);
            //ch = HashAddArray(ch, atlasTexturesForeground);
            //ch = HashAdd(ch, guiDepth);
            //ch = HashAdd(ch, growDirection);
            //ch = HashAdd(ch, effectBurn);
            //ch = HashAddTexture(ch, effectBurnTextureBar);
            //ch = HashAdd(ch, atlasEffectBurnTextureBarGUID);
            //ch = HashAdd(ch, labelEnabled);
            //ch = HashAdd(ch, labelFont);
            //ch = HashAdd(ch, effectFollow);
            //ch = HashAdd(ch, premultipliedAlpha);

            if (ch != lastRebuildHash || dirty)
            {
                lastRebuildHash = ch;
                dirty           = false;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #11
0
    protected static int HashAddTextureArray(int current, Texture[] arr, string name = "")
    {
#if UNITY_EDITOR
        for (int i = 0; i < arr.Length; ++i)
        {
            string path = AssetDatabase.GetAssetPath(arr[i]);
            string guid = AssetDatabase.AssetPathToGUID(path);
            current = MadHashCode.Add(current, guid);
        }

        return(current);
#else
        return(MadHashCode.AddArray(current, arr));
#endif
    }
Пример #12
0
 bool RebuildNeeded() {
     var hash = new MadHashCode();
     hash.AddEnumerable(texturesBackground);
     hash.Add(textureIcon);
     hash.Add(textureSlot);
     hash.Add(repeatCount);
     hash.Add(repeatPositionDelta);
     hash.Add(guiDepth);
     hash.Add(growType);
     hash.Add(fillDirection);
     hash.Add(labelEnabled);
     hash.Add(labelFont);
     hash.Add(pivot);
     
     int hashNumber = hash.GetHashCode();
     
     if (hashNumber != lastRebuildHash || dirty) {
         lastRebuildHash = hashNumber;
         dirty = false;
         return true;
     } else {
         return false;
     }
 }
Пример #13
0
    bool RebuildNeeded() {
        if (panel == null) {
            return false;
        }

        int ch = MadHashCode.FirstPrime;
        ch = MadHashCode.Add(ch, textureMode);

        ch = HashAdd(ch, panel);
        ch = HashAdd(ch, textureMode);
        ch = HashAddArray(ch, texturesBackground);
        ch = HashAddTexture(ch, textureBar);
        ch = HashAddArray(ch, texturesForeground);
        ch = HashAdd(ch, atlas);
        ch = HashAddArray(ch, atlasTexturesBackground);
        ch = HashAdd(ch, atlasTextureBarGUID);
        ch = HashAddArray(ch, atlasTexturesForeground);
        ch = HashAdd(ch, guiDepth);
        ch = HashAdd(ch, growDirection);
        ch = HashAdd(ch, effectBurn);
        ch = HashAddTexture(ch, effectBurnTextureBar);
        ch = HashAdd(ch, atlasEffectBurnTextureBarGUID);
        ch = HashAdd(ch, labelEnabled);
        ch = HashAdd(ch, labelFont);
        ch = HashAdd(ch, effectFollow);
        ch = HashAdd(ch, premultipliedAlpha);

        if (effectFollowObject != null && effectFollowObject is Texture) {
            ch = HashAddTexture(ch, effectFollowObject as Texture);
        } else {
            ch = HashAdd(ch, effectFollowObject);
        }
        
        //ch = HashAdd(ch, radialOffset);
        //ch = HashAdd(ch, radialLength);
        
        if (ch != lastRebuildHash || dirty) {
            lastRebuildHash = ch;
            dirty = false;
            return true;
        } else {
            return false;
        }
    }
Пример #14
0
 bool RebuildNeeded() {
     var hash = new MadHashCode();
     hash.AddEnumerable(texturesBackground);
     hash.Add(textureBar);
     hash.AddEnumerable(texturesForeground);
     hash.Add(guiDepth);
     hash.Add(growDirection);
     hash.Add(effectBurn);
     hash.Add(labelEnabled);
     hash.Add(labelFont);
     hash.Add(effectFollow);
     hash.Add(effectFollowObject);
     
     int hashNumber = hash.GetHashCode();
 
     if (hashNumber != lastRebuildHash || dirty) {
         lastRebuildHash = hashNumber;
         dirty = false;
         return true;
     } else {
         return false;
     }
 }
Пример #15
0
    private int ComputeHash() {
        var hashCode = new MadHashCode();
        hashCode.Add(configuration);
        hashCode.Add(configurationGroup);
        hashCode.Add(hideManagedObjects);
        hashCode.Add(setupMethod);
        hashCode.Add(iconTemplate);
        hashCode.Add(iconScale);
        hashCode.Add(iconOffset);
        hashCode.Add(leftSlideSprite);
        hashCode.Add(leftSlideScale);
        hashCode.Add(leftSlideOffset);
        hashCode.Add(rightSlideSprite);
        hashCode.Add(rightSlideScale);
        hashCode.Add(rightSlideOffset);
        hashCode.Add(gridWidth);
        hashCode.Add(gridHeight);
        hashCode.Add(horizontalAlign);
        hashCode.Add(verticalAlign);
        hashCode.Add(pixelsWidth);
        hashCode.Add(pixelsHeight);
        hashCode.Add(pagesOffsetManual);
        hashCode.Add(pagesOffsetFromResolution);
        hashCode.Add(enumerationType);

        return hashCode.GetHashCode();
    }
Пример #16
0
 protected static int HashAdd(int current, object obj)
 {
     return(MadHashCode.Add(current, obj));
 }
Пример #17
0
    bool RebuildNeeded() {
        if (panel == null) {
            return false;
        }

        var hash = new MadHashCode();
        hash.AddEnumerable(texturesBackground);
        hash.Add(atlas);
        hash.Add(textureIcon);
        hash.Add(textureSlot);
        hash.Add(atlasTextureIconGUID);
        hash.Add(atlasTextureSlotGUID);
        hash.Add(repeatCount);
        hash.Add(repeatPositionDelta);
        hash.Add(repeatRotationDelta);
        hash.Add(guiDepth);
        hash.Add(growType);
        hash.Add(fillDirection);
        hash.Add(labelEnabled);
        hash.Add(labelFont);
        hash.Add(pivot);
        hash.Add(premultipliedAlpha);
        
        int hashNumber = hash.GetHashCode();
        
        if (hashNumber != lastRebuildHash || dirty) {
            lastRebuildHash = hashNumber;
            dirty = false;
            return true;
        } else {
            return false;
        }
    }
Пример #18
0
    bool RebuildNeeded() {
        if (panel == null) {
            return false;
        }

        var hash = new MadHashCode();
        hash.Add(textureMode);
        hash.Add(atlas);
            
        hash.AddEnumerable(texturesBackground);
        hash.AddEnumerable(atlasTexturesBackground);
        hash.AddEnumerable(texturesForeground);
        hash.AddEnumerable(atlasTexturesForeground);
        hash.Add(renderingMethod);
        hash.Add(gridTexture);
        hash.Add(gridAtlasTextureGUID);
        hash.AddEnumerable(sequenceTextures);
        hash.AddEnumerable(sequenceAtlasTexturesGUID);
        hash.Add(gridWidth);
        hash.Add(gridHeight);
        hash.Add(gridFrameCountManual);
        hash.Add(gridFrameCount);
        hash.Add(guiDepth);
        hash.Add(labelEnabled);
        hash.Add(labelFont);
        hash.Add(premultipliedAlpha);
        
        int hashNumber = hash.GetHashCode();
        
        if (hashNumber != lastRebuildHash || dirty) {
            lastRebuildHash = hashNumber;
            dirty = false;
            return true;
        } else {
            return false;
        }
    }
Пример #19
0
        public override int GetHashCode()
        {
            var hash = new MadHashCode();
            hash.Add(texture);
            hash.Add(color);

            return hash.GetHashCode();
        }
Пример #20
0
    bool RebuildNeeded() {
        if (panel == null) {
            return false;
        }

        var hash = new MadHashCode();
        hash.AddEnumerable(texturesBackground);
        hash.Add(atlas);
        hash.Add(textureIcon);
        hash.Add(textureSlot);
        hash.Add(atlasTextureIconGUID);
        hash.Add(atlasTextureSlotGUID);
        hash.Add(repeatCount);
        hash.Add(repeatPositionDelta);
        hash.Add(guiDepth);
        hash.Add(growType);
        hash.Add(fillDirection);
        hash.Add(labelEnabled);
        hash.Add(labelFont);
        hash.Add(pivot);
        hash.Add(premultipliedAlpha);
        
        int hashNumber = hash.GetHashCode();
        
        if (hashNumber != lastRebuildHash || dirty) {
            lastRebuildHash = hashNumber;
            dirty = false;
            return true;
        } else {
            return false;
        }
    }
Пример #21
0
    private bool RebuildNeeded() {
        if (panel == null) {
            return false;
        }

        var hash = new MadHashCode();

        hash.Add(textureMode);
        hash.Add(atlas);

        hash.Add(objectTexture);
        hash.Add(objectAtlasTextureGUID);

        hash.Add(objectAnchor);

        hash.AddEnumerable(texturesBackground);
        hash.AddEnumerable(atlasTexturesBackground);
        hash.AddEnumerable(texturesForeground);
        hash.AddEnumerable(atlasTexturesForeground);

        hash.Add(transformTranslate);
        hash.Add(transformRotate);
        hash.Add(transformScale);

        hash.Add(translateFunction);
        hash.Add(rotateFunction);
        hash.Add(scaleFunction);

        hash.Add(premultipliedAlpha);

        int hashNumber = hash.GetHashCode();

        if (hashNumber != lastRebuildHash || dirty) {
            lastRebuildHash = hashNumber;
            dirty = false;
            return true;
        } else {
            return false;
        }
    }
Пример #22
0
    private bool RebuildNeeded() {
        if (panel == null) {
            return false;
        }

        var hash = new MadHashCode();

        hash.Add(textureMode);
        hash.Add(atlas);

        hash.Add(objectTexture);
        hash.Add(objectAtlasTextureGUID);

        hash.Add(objectAnchor);

        hash.AddEnumerable(texturesBackground);
        hash.AddEnumerable(atlasTexturesBackground);
        hash.AddEnumerable(texturesForeground);
        hash.AddEnumerable(atlasTexturesForeground);

        hash.Add(transformTranslate);
        hash.Add(transformRotate);
        hash.Add(transformScale);

        hash.Add(translateFunction);
        hash.Add(rotateFunction);
        hash.Add(scaleFunction);

        hash.Add(labelEnabled);
        hash.Add(labelFont);

        hash.Add(premultipliedAlpha);

        int hashNumber = hash.GetHashCode();

        if (hashNumber != lastRebuildHash || dirty) {
            lastRebuildHash = hashNumber;
            dirty = false;
            return true;
        } else {
            return false;
        }
    }
Пример #23
0
 // ===========================================================
 // Methods
 // ===========================================================
 
 public override int GetHashCode() {
     var hash = new MadHashCode();
     hash.Add(texture);
     hash.Add(glyphs);
     hash.Add(linesCount);
     hash.Add(fillFactorTolerance);
     hash.Add(createStatus);
     hash.Add(created);
     hash.Add(material);
     hash.Add(dimensions);
     
     return hash.GetHashCode();
 }
Пример #24
0
    bool RebuildNeeded() {
        if (panel == null) {
            return false;
        }

        var hash = new MadHashCode();
        hash.Add(textureMode);
        hash.Add(atlas);
            
        hash.AddEnumerable(texturesBackground);
        hash.AddEnumerable(atlasTexturesBackground);
        hash.AddEnumerable(texturesForeground);
        hash.AddEnumerable(atlasTexturesForeground);
        hash.Add(renderingMethod);
        hash.Add(gridTexture);
        hash.Add(gridAtlasTextureGUID);
        hash.AddEnumerable(sequenceTextures);
        hash.AddEnumerable(sequenceAtlasTexturesGUID);
        hash.Add(gridWidth);
        hash.Add(gridHeight);
        hash.Add(gridFrameCountManual);
        hash.Add(gridFrameCount);
        hash.Add(guiDepth);
        hash.Add(labelEnabled);
        hash.Add(labelFont);
        hash.Add(premultipliedAlpha);
        
        int hashNumber = hash.GetHashCode();
        
        if (hashNumber != lastRebuildHash || dirty) {
            lastRebuildHash = hashNumber;
            dirty = false;
            return true;
        } else {
            return false;
        }
    }
Пример #25
0
 int ConfigurationHash() {
     var hash = new MadHashCode();
     hash.Add(bulletTextureOff);
     hash.Add(bulletTextureOn);
     hash.Add(hideManagedObjects);
     hash.Add(bulletDistance);
     hash.Add(guiDepth);
     if (draggable != null) {
         hash.Add(draggable.dragStopCount);
     }
     return hash.GetHashCode();
 }
Пример #26
0
        bool RebuildNeeded()
        {
            var hash = new MadHashCode();
            hash.AddEnumerable(texturesBackground);
            hash.Add(textureBar);
            hash.AddEnumerable(texturesForeground);
            hash.Add(guiDepth);
            hash.Add(growDirection);
            hash.Add(effectBurn);
            hash.Add(labelEnabled);
            hash.Add(labelFont);
            hash.Add(effectFollow);
            hash.Add(effectFollowObject);

            int hashNumber = hash.GetHashCode();

            if (hashNumber != lastRebuildHash || dirty) {
            lastRebuildHash = hashNumber;
            dirty = false;
            return true;
            } else {
            return false;
            }
        }