Пример #1
0
        /// <summary>
        /// 将动作序列和从属于它的动作序列全部IL化
        /// </summary>
        /// <param name="saRoot">递归开始节点</param>
        /// <returns>IL字符串</returns>
        private string ILGenerator(SceneAction saRoot)
        {
            StringBuilder       resSb        = new StringBuilder(String.Empty);
            Stack <SceneAction> processStack = new Stack <SceneAction>();

            processStack.Push(saRoot);
            while (processStack.Count != 0)
            {
                SceneAction topSa = processStack.Pop();
                // 栈,先处理falseRouting
                if (topSa.FalseRouting != null)
                {
                    for (int i = topSa.FalseRouting.Count - 1; i >= 0; i--)
                    {
                        processStack.Push(topSa.FalseRouting[i]);
                    }
                }
                // 处理trueRouting
                if (topSa.TrueRouting != null)
                {
                    for (int i = topSa.TrueRouting.Count - 1; i >= 0; i--)
                    {
                        processStack.Push(topSa.TrueRouting[i]);
                    }
                }
                resSb.AppendLine(Pile.needEncryption
                    ? YuriEncryptor.EncryptString(topSa.ToIL(), Pile.Encryptor)
                    : topSa.ToIL());
            }
            return(resSb.ToString());
        }
Пример #2
0
        /// <summary>
        /// 将场景做IL序列化
        /// </summary>
        /// <param name="scene">场景实例</param>
        /// <returns>IL字符串</returns>
        private string ILGenerator(Scene scene)
        {
            List <SceneFunction> sf     = scene.FuncContainer;
            SceneAction          mainSa = scene.Ctor;
            StringBuilder        sb     = new StringBuilder();

            sb.AppendLine(Pile.needEncryption
                ? YuriEncryptor.EncryptString(scene.GetILSign(), Pile.Encryptor)
                : scene.GetILSign());
            sb.Append(this.ILGenerator(mainSa));
            foreach (SceneFunction scenefunc in sf)
            {
                sb.Append(this.ILGenerator(scenefunc.Ctor));
            }
            return(sb.ToString());
        }