public bool CheckKnotStitchChanged()
        {
            StoryStateWrapper ssw   = new StoryStateWrapper(story.state);
            string            cPath = ssw.CPath;

            if (cPath == null)
            {
                return(false);
            }

            string knotStitch;

            string[] knotStitchEtc = cPath.Split('.');
            if (knotStitchEtc.Length <= 2 || char.IsNumber(knotStitchEtc[1], 0))
            {
                knotStitch = knotStitchEtc[0]; // only knot
            }
            else
            {
                knotStitch = knotStitchEtc[0] + '.' + knotStitchEtc[1]; // knot.stitch
            }
            Debug.Log("Current knot.stitch = " + knotStitch);
            if (knotStitch != lastKnotStitch)
            {
                lastKnotStitch = knotStitch;
                BroadcastToFungus(newKnotStitchMessage);
                BroadcastToFungus(newKnotStitchMessage + " " + knotStitch);
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public bool CheckKnotStitchChanged()
        {
            string cPath = new StoryStateWrapper(story.state).cPath;

            if (cPath == null)
            {
                Debug.LogWarning("cPath is null, cannot check if knot.stitch changed");
                return(false);
            }

            string knotStitch;

            string[] knotStitchEtc = cPath.Split('.');
            if (knotStitchEtc.Length <= 2 || char.IsNumber(knotStitchEtc[1], 0))
            {
                knotStitch = knotStitchEtc[0]; // only knot
            }
            else
            {
                knotStitch = knotStitchEtc[0] + '.' + knotStitchEtc[1]; // knot.stitch
            }
            Log(LogLevel.Verbose, "Current knot.stitch = " + knotStitch);
            if (knotStitch != lastKnotStitch)
            {
                lastKnotStitch = knotStitch;
                BroadcastToFungus(newKnotStitchMessage);
                BroadcastToFungus(newKnotStitchMessage + " " + knotStitch);
                return(true);
            }
            return(false);
        }