Exemplo n.º 1
0
        private static void RemoveChainCues(Target.TargetHandType handType)
        {
            int length = songCues.Count - 1;
            int index  = 0;

            for (int i = 0; i < length; i++)
            {
                SongCues.Cue cue = songCues[index];
                if (cue.handType == handType)
                {
                    if (cue.behavior == Target.TargetBehavior.Chain)
                    {
                        songCues.RemoveAt(index);
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    index++;
                }
            }
        }
Exemplo n.º 2
0
 private void RepairChains()
 {
     foreach (KeyValuePair <float, Chain> entry in oldChains)
     {
         if (entry.Value.nodes[0].tick < AudioDriver.I.mCachedTick + 960)
         {
             continue;
         }
         bool startSet = false;
         Target.TargetHandType handType = entry.Value.handType;
         foreach (SongCues.Cue cue in entry.Value.nodes)
         {
             if (startSet)
             {
                 cue.behavior = Target.TargetBehavior.Chain;
             }
             else
             {
                 cue.behavior = Target.TargetBehavior.ChainStart;
                 startSet     = true;
             }
             cue.handType = entry.Value.handType;
         }
     }
 }
Exemplo n.º 3
0
 private void UnhookQueuedChains()
 {
     oldChains = queuedChains;
     foreach (KeyValuePair <float, Chain> chain in queuedChains)
     {
         if (chain.Value.nodes[0].nextCue.tick - chain.Value.nodes[0].tick < speedToTicks[unhookChainsParams.maxStreamSpeed])
         {
             continue;
         }
         Target.TargetHandType handType = chain.Value.handType;
         foreach (SongCues.Cue cue in chain.Value.nodes)
         {
             cue.behavior = Target.TargetBehavior.Standard;
             cue.handType = handType;
             if (handType == Target.TargetHandType.Left)
             {
                 handType = Target.TargetHandType.Right;
             }
             else
             {
                 handType = Target.TargetHandType.Left;
             }
         }
     }
 }
Exemplo n.º 4
0
        private void ModifyChains(bool unhook)
        {
            SongCues.Cue[] cues = SongCues.I.mCues.cues;
            if (unhook)
            {
                bool checkForChain = false;
                for (int i = 0; i < cues.Length; i++)
                {
                    if (cues[i].behavior == Target.TargetBehavior.Dodge)
                    {
                        continue;
                    }
                    if (cues[i].behavior == Target.TargetBehavior.Chain)
                    {
                        continue;
                    }
                    if (cues[i].tick < AudioDriver.I.mCachedTick + 1920)
                    {
                        continue;
                    }
                    if (checkForChain)
                    {
                        List <SongCues.Cue> nodes = queuedChains.Last().Value.nodes;
                        if (queuedChains.ContainsKey(cues[i].tick))
                        {
                            queuedChains.Remove(queuedChains.Last().Key);
                            checkForChain = false;
                            continue;
                        }
                        if (nodes[0].tick <= cues[i].tick && nodes[nodes.Count - 1].tick >= cues[i].tick)
                        {
                            queuedChains.Remove(queuedChains.Last().Key);
                            checkForChain = false;
                            continue;
                        }
                        checkForChain = false;
                    }

                    if (cues[i].behavior != Target.TargetBehavior.ChainStart)
                    {
                        continue;
                    }


                    Target.TargetHandType handType = cues[i].handType;
                    List <SongCues.Cue>   chain    = new List <SongCues.Cue>();
                    RecursiveAdd(cues[i], chain);
                    queuedChains.Add(cues[i].tick, new Chain(handType, chain));
                    checkForChain = true;
                }
                UnhookQueuedChains();
            }
            else
            {
                RepairChains();
            }
        }
        private static void SetFirepoint(GunExtras.GunConfig handConfig, Target.TargetHandType hand)
        {
            Gun desiredGun = KataConfig.I.GetGun(hand);

            if (desiredGun == null)
            {
                MelonLogger.LogError("Can not find gun");
                return;
            }

            if (handConfig != null && handConfig.firepoint != null)
            {
                desiredGun.firepoint.localPosition = new Vector3(handConfig.firepoint.x, handConfig.firepoint.y, handConfig.firepoint.z);
            }
            else
            {
                desiredGun.firepoint = desiredGun.firepointDefaultPosition;
            }
        }
Exemplo n.º 6
0
            private static void Postfix(Target __instance, Target.TargetBehavior behavior, Target.TargetHandType handType)
            {
                if (behavior == Target.TargetBehavior.Chain)
                {
                    Target target = __instance;

                    Color rightColor;
                    Color leftColor;

                    if (ChainFixer.config.handColor)
                    {
                        rightColor = PlayerPreferences.I.GunColorRight.Get() / 2;
                        leftColor  = PlayerPreferences.I.GunColorLeft.Get() / 2;
                    }
                    else
                    {
                        rightColor = new Color(ChainFixer.config.rightR, ChainFixer.config.rightG, ChainFixer.config.rightB);
                        leftColor  = new Color(ChainFixer.config.leftR, ChainFixer.config.leftG, ChainFixer.config.leftB);
                    }

                    if (handType == Target.TargetHandType.Right)
                    {
                        target.chainLine.startColor = rightColor;
                        target.chainLine.endColor   = rightColor;
                    }
                    else if (handType == Target.TargetHandType.Left)
                    {
                        target.chainLine.startColor = leftColor;
                        target.chainLine.endColor   = leftColor;
                    }
                    else
                    {
                        target.chainLine.startColor = KataConfig.I.eitherHandColor;
                        target.chainLine.endColor   = KataConfig.I.eitherHandColor;
                    }
                }
            }
Exemplo n.º 7
0
 public Chain(Target.TargetHandType _handType, List <SongCues.Cue> _nodes)
 {
     handType = _handType;
     nodes    = _nodes;
 }
Exemplo n.º 8
0
 public BehaviorType(Target.TargetBehavior _behavior, Target.TargetHandType _handType)
 {
     behavior = _behavior;
     handType = _handType;
 }