コード例 #1
0
        private static XmlObjectNode GetIfLogicElseBrickObject(XmlIfLogicElseBrickReference ifLogicElseBrickReference, string reference)
        {
            bool found = false;
            var ifLogicElseBricks = new List<XmlBrick>();

            var sprite = XmlParserTempProjectHelper.Sprite;

                var script = XmlParserTempProjectHelper.Script;

                    foreach (var brick in script.Bricks.Bricks)
                    {
                        if (brick is XmlIfLogicBeginBrick)
                        {
                            var ifLogicBeginBrick = brick as XmlIfLogicBeginBrick;
                            if (ifLogicBeginBrick.IfLogicElseBrickReference == ifLogicElseBrickReference)
                                found = true;
                        }
                        if (brick is XmlIfLogicEndBrick)
                        {
                            var ifLogicEndBrick = brick as XmlIfLogicEndBrick;
                            if (ifLogicEndBrick.IfLogicElseBrickReference == ifLogicElseBrickReference)
                                found = true;
                        }
                        if (brick is XmlIfLogicElseBrick)
                            ifLogicElseBricks.Add(brick);
                    }
                    if (found)
                    {
                        var count = 0;
                        if (reference.EndsWith("]"))
                        {
                            var splittetReference = reference.Split('[');
                            reference = reference.Split('[')[splittetReference.Count() - 1];
                            reference = reference.Split(']')[0];
                            count = Int32.Parse(reference) - 1;
                        }
                        return ifLogicElseBricks[count];
                    }
                
            return null;
        }
コード例 #2
0
        private static string GetIfLogicElseBrickReferenceString(XmlIfLogicElseBrickReference ifLogicElseBrickReference)
        {
            var ifLogicElseBrick = ifLogicElseBrickReference.IfLogicElseBrick;

            var sprite = XmlParserTempProjectHelper.Sprite;

            var script = XmlParserTempProjectHelper.Script;

                var count = 0;
                foreach (var brick in script.Bricks.Bricks)
                    if (brick is XmlIfLogicElseBrick)
                    {
                        count++;
                        if ((brick == ifLogicElseBrick) && (count == 1))
                            return "../../ifLogicElseBrick";
                        else if (brick == ifLogicElseBrick)
                            return "../../ifLogicElseBrick[" + count + "]";
                    }
            
            return "";
        }