public void SetSymbolTint(KAnimHashedString symbol, Color32 colour)
 {
     if ((UnityEngine.Object)meterController != (UnityEngine.Object)null)
     {
         meterController.SetSymbolTint(symbol, colour);
     }
 }
Ejemplo n.º 2
0
 public void SetSymbolTint(KAnimHashedString symbol, Color32 color)
 {
     if (variantController == null)
     {
         return;
     }
     variantController.SetSymbolTint(symbol, color);
 }
Ejemplo n.º 3
0
 public void SetSymbolTint(KAnimHashedString symbol_name, Color color)
 {
     KAnim.Build.Symbol symbol = KAnimBatchManager.Instance().GetBatchGroupData(GetBatchGroupID(false)).GetSymbol(symbol_name);
     if (symbol != null)
     {
         base.symbolInstanceGpuData.SetSymbolTint(symbol.symbolIndexInSourceBuild, color);
         SuspendUpdates(false);
         SetDirty();
     }
 }
Ejemplo n.º 4
0
    public int GetSymbolIndex(KAnimHashedString symbol)
    {
        int value = 0;

        if (!frameElementSymbolIndices.TryGetValue(symbol, out value))
        {
            return(-1);
        }
        return(value);
    }
Ejemplo n.º 5
0
 public AnimEvent(string file, string name, int frame)
 {
     this.file = ((!(file == string.Empty)) ? file : null);
     if (this.file != null)
     {
         fileHash = new KAnimHashedString(this.file);
     }
     this.name  = name;
     this.frame = frame;
 }
 public Symbol GetSymbol(KAnimHashedString symbol_name)
 {
     for (int i = 0; i < symbols.Length; i++)
     {
         if (symbols[i].hash == symbol_name)
         {
             return(symbols[i]);
         }
     }
     return(null);
 }
 public int GetSymbolOffset(KAnimHashedString symbol_name)
 {
     for (int i = 0; i < symbols.Length; i++)
     {
         if (symbols[i].hash == symbol_name)
         {
             return(i);
         }
     }
     return(-1);
 }
 public AccessorySlot(string id, ResourceSet parent, KAnimFile swap_build, string build_symbol_override = null)
     : base(id, parent, null)
 {
     if ((Object)swap_build == (Object)null)
     {
         Debug.LogErrorFormat("AccessorySlot {0} missing swap_build", id);
     }
     targetSymbolId = new KAnimHashedString("snapTo_" + id.ToLower());
     accessories    = new List <Accessory>();
     file           = swap_build;
 }
Ejemplo n.º 9
0
 public KAnim.Build AddNewBuildFile(KAnimHashedString fileHash)
 {
     textureStartIndex.Add(fileHash, textures.Count);
     firstSymbolIndex.Add(fileHash, GetSymbolCount());
     KAnim.Build build = new KAnim.Build();
     build.textureStartIdx = textures.Count;
     build.fileHash        = fileHash;
     build.index           = builds.Count;
     builds.Add(build);
     return(build);
 }
Ejemplo n.º 10
0
 public KAnim.Build.Symbol GetSymbol(KAnimHashedString symbol_name)
 {
     foreach (KAnim.Build.Symbol frameElementSymbol in frameElementSymbols)
     {
         if (frameElementSymbol.hash == symbol_name)
         {
             return(frameElementSymbol);
         }
     }
     return(null);
 }
 public KAnimFileData(string name)
 {
     this.name          = name;
     firstAnimIndex     = -1;
     buildIndex         = -1;
     firstElementIndex  = -1;
     animCount          = 0;
     frameCount         = 0;
     elementCount       = 0;
     maxVisSymbolFrames = 0;
     hashName           = new KAnimHashedString(name);
 }
 public void SetSymbolVisiblity(KAnimHashedString symbol, bool is_visible)
 {
     if (is_visible)
     {
         hiddenSymbols.Remove(symbol);
     }
     else if (!hiddenSymbols.Contains(symbol))
     {
         hiddenSymbols.Add(symbol);
     }
     if (curBuild != null)
     {
         UpdateHidden();
     }
 }
Ejemplo n.º 13
0
    private static KAnim.Build.Symbol GetSymbol(KAnimFile anim_file, string symbol_name)
    {
        KAnim.Build.Symbol result = anim_file.GetData().build.symbols[0];
        KAnimHashedString  y      = new KAnimHashedString(symbol_name);

        KAnim.Build.Symbol[] symbols = anim_file.GetData().build.symbols;
        foreach (KAnim.Build.Symbol symbol in symbols)
        {
            if (symbol.hash == y)
            {
                result = symbol;
                break;
            }
        }
        return(result);
    }
    private void ShowHelmet()
    {
        KBatchedAnimController assigneeController = GetAssigneeController();

        if (!((Object)assigneeController == (Object)null))
        {
            KAnimHashedString kAnimHashedString = new KAnimHashedString("snapTo_neck");
            if (!string.IsNullOrEmpty(anim_file))
            {
                KAnimFile anim = Assets.GetAnim(anim_file);
                assigneeController.GetComponent <SymbolOverrideController>().AddSymbolOverride(kAnimHashedString, anim.GetData().build.GetSymbol(kAnimHashedString), 6);
            }
            assigneeController.SetSymbolVisiblity(kAnimHashedString, true);
            is_shown = true;
            UpdateJets();
        }
    }
    private void HideHelmet()
    {
        is_shown = false;
        KBatchedAnimController assigneeController = GetAssigneeController();

        if (!((Object)assigneeController == (Object)null))
        {
            KAnimHashedString kAnimHashedString = "snapTo_neck";
            if (!string.IsNullOrEmpty(anim_file))
            {
                SymbolOverrideController component = assigneeController.GetComponent <SymbolOverrideController>();
                if ((Object)component == (Object)null)
                {
                    return;
                }
                component.RemoveSymbolOverride(kAnimHashedString, 6);
            }
            assigneeController.SetSymbolVisiblity(kAnimHashedString, false);
            UpdateJets();
        }
    }
Ejemplo n.º 16
0
        /// <summary>
        /// Applied before SetSymbolVisiblity runs.
        /// </summary>
        internal static bool Prefix(KAnimControllerBase __instance, KAnimHashedString symbol,
                                    bool is_visible)
        {
            bool changed = false;
            var  hidden  = __instance.hiddenSymbols;

            if (is_visible)
            {
                changed = hidden.Remove(symbol);
            }
            else if (!hidden.Contains(symbol))
            {
                hidden.Add(symbol);
                // This is not called all that often and the hidden symbol list is usually
                // quite small, so not worth changing to hash set
                changed = true;
            }
            if (changed && __instance.curBuild != null)
            {
                __instance.UpdateHidden();
            }
            return(false);
        }
 public bool GetSymbolVisiblity(KAnimHashedString symbol)
 {
     return(!hiddenSymbols.Contains(symbol));
 }
Ejemplo n.º 18
0
 public int GetFirstIndex(KAnimHashedString symbol)
 {
     return(frameElementSymbols.FindIndex((KAnim.Build.Symbol fes) => fes.hash == symbol));
 }
    public static int ParseBuildData(KBatchGroupData data, KAnimHashedString fileNameHash, FastReader reader, List <Texture2D> textures)
    {
        CheckHeader("BILD", reader);
        int num = reader.ReadInt32();

        if (num != 10 && num != 9)
        {
            Debug.LogError(fileNameHash + " has invalid build.bytes version [" + num + "]");
            return(-1);
        }
        KAnimGroupFile.Group group = KAnimGroupFile.GetGroup(data.groupID);
        if (group == null)
        {
            Debug.LogErrorFormat("[{1}] Failed to get group [{0}]", data.groupID, fileNameHash.DebuggerDisplay);
        }
        KAnim.Build build = null;
        int         num2  = reader.ReadInt32();
        int         num3  = reader.ReadInt32();

        build = data.AddNewBuildFile(fileNameHash);
        build.textureCount = textures.Count;
        if (textures.Count > 0)
        {
            data.AddTextures(textures);
        }
        build.symbols  = new KAnim.Build.Symbol[num2];
        build.frames   = new KAnim.Build.SymbolFrame[num3];
        build.name     = reader.ReadKleiString();
        build.batchTag = ((!group.swapTarget.IsValid) ? data.groupID : group.target);
        build.fileHash = fileNameHash;
        int num4 = 0;

        for (int i = 0; i < build.symbols.Length; i++)
        {
            KAnimHashedString  hash   = new KAnimHashedString(reader.ReadInt32());
            KAnim.Build.Symbol symbol = new KAnim.Build.Symbol();
            symbol.build = build;
            symbol.hash  = hash;
            if (num > 9)
            {
                symbol.path = new KAnimHashedString(reader.ReadInt32());
            }
            symbol.colourChannel            = new KAnimHashedString(reader.ReadInt32());
            symbol.flags                    = reader.ReadInt32();
            symbol.firstFrameIdx            = data.symbolFrameInstances.Count;
            symbol.numFrames                = reader.ReadInt32();
            symbol.symbolIndexInSourceBuild = i;
            int num5 = 0;
            for (int j = 0; j < symbol.numFrames; j++)
            {
                KAnim.Build.SymbolFrame         symbolFrame = new KAnim.Build.SymbolFrame();
                KAnim.Build.SymbolFrameInstance item        = default(KAnim.Build.SymbolFrameInstance);
                item.symbolFrame           = symbolFrame;
                symbolFrame.fileNameHash   = fileNameHash;
                symbolFrame.sourceFrameNum = reader.ReadInt32();
                symbolFrame.duration       = reader.ReadInt32();
                item.buildImageIdx         = data.textureStartIndex[fileNameHash] + reader.ReadInt32();
                if (item.buildImageIdx >= textures.Count + data.textureStartIndex[fileNameHash])
                {
                    Debug.LogErrorFormat("{0} Symbol: [{1}] tex count: [{2}] buildImageIdx: [{3}] group total [{4}]", fileNameHash.ToString(), symbol.hash, textures.Count, item.buildImageIdx, data.textureStartIndex[fileNameHash]);
                }
                item.symbolIdx = data.GetSymbolCount();
                num5           = Math.Max(symbolFrame.sourceFrameNum + symbolFrame.duration, num5);
                float num6 = reader.ReadSingle();
                float num7 = reader.ReadSingle();
                float num8 = reader.ReadSingle();
                float num9 = reader.ReadSingle();
                symbolFrame.bboxMin = new Vector2(num6 - num8 * 0.5f, num7 - num9 * 0.5f);
                symbolFrame.bboxMax = new Vector2(num6 + num8 * 0.5f, num7 + num9 * 0.5f);
                float x     = reader.ReadSingle();
                float num10 = reader.ReadSingle();
                float x2    = reader.ReadSingle();
                float num11 = reader.ReadSingle();
                symbolFrame.uvMin  = new Vector2(x, 1f - num10);
                symbolFrame.uvMax  = new Vector2(x2, 1f - num11);
                build.frames[num4] = symbolFrame;
                data.symbolFrameInstances.Add(item);
                num4++;
            }
            symbol.numLookupFrames = num5;
            data.AddBuildSymbol(symbol);
            build.symbols[i] = symbol;
        }
        ParseHashTable(reader);
        return(build.index);
    }
    public KAnim.Anim.FrameElement FindAnimFrameElement(KAnimHashedString symbolName)
    {
        KBatchGroupData batchGroupData = KAnimBatchManager.Instance().GetBatchGroupData(animBatchTag);

        return(batchGroupData.frameElements.Find((KAnim.Anim.FrameElement match) => match.symbol == symbolName));
    }