예제 #1
0
파일: LProcess.cs 프로젝트: nobcdz/LGame
 public AssetsSoundManager GetAssetsSound()
 {
     if (this.asm == null)
     {
         this.asm = AssetsSoundManager.GetInstance();
     }
     return(asm);
 }
예제 #2
0
        public void NextScript()
        {
            lock (synch)
            {
                if (command != null && !IsClose() && running)
                {
                    for (; isRunning = command.Next();)
                    {
                        string result = command.DoExecute();
                        if (result == null)
                        {
                            continue;
                        }
                        if (!NextScript(result))
                        {
                            break;
                        }
                        IList  commands = Command.SplitToList(result, " ");
                        int    size     = commands.Count;
                        string cmdFlag  = (string)commands[0];

                        string mesFlag = null, orderFlag = null, lastFlag = null;
                        if (size == 2)
                        {
                            mesFlag = (string)commands[1];
                        }
                        else if (size == 3)
                        {
                            mesFlag   = (string)commands[1];
                            orderFlag = (string)commands[2];
                        }
                        else if (size == 4)
                        {
                            mesFlag   = (string)commands[1];
                            orderFlag = (string)commands[2];
                            lastFlag  = (string)commands[3];
                        }
                        if (cmdFlag.Equals(CommandType.L_APLAY, StringComparison.InvariantCultureIgnoreCase))
                        {
                            autoPlay = true;
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_ASTOP, StringComparison.InvariantCultureIgnoreCase))
                        {
                            autoPlay = false;
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_ADELAY, StringComparison.InvariantCultureIgnoreCase))
                        {
                            if (mesFlag != null)
                            {
                                if (NumberUtils.IsNan(mesFlag))
                                {
                                    autoTimer.SetDelay(int.Parse(mesFlag));
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_WAIT, StringComparison.InvariantCultureIgnoreCase))
                        {
                            scrFlag = true;
                            break;
                        }
                        if (cmdFlag.Equals(CommandType.L_SNOW, StringComparison.InvariantCultureIgnoreCase) ||
                            cmdFlag.Equals(CommandType.L_RAIN, StringComparison.InvariantCultureIgnoreCase) ||
                            cmdFlag.Equals(CommandType.L_PETAL, StringComparison.InvariantCultureIgnoreCase))
                        {
                            if (sprites != null)
                            {
                                bool      flag = false;
                                ISprite[] ss   = sprites.GetSprites();

                                for (int i = 0; i < ss.Length; i++)
                                {
                                    ISprite s = ss[i];
                                    if (s is FreedomEffect)
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                                if (!flag)
                                {
                                    if (cmdFlag
                                        .Equals(CommandType.L_SNOW))
                                    {
                                        sprites.Add(FreedomEffect.GetSnowEffect());
                                    }
                                    else if (cmdFlag
                                             .Equals(CommandType.L_RAIN))
                                    {
                                        sprites.Add(FreedomEffect.GetRainEffect());
                                    }
                                    else if (cmdFlag
                                             .Equals(CommandType.L_PETAL))
                                    {
                                        sprites.Add(FreedomEffect.GetPetalEffect());
                                    }
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_SNOWSTOP) ||
                            cmdFlag.Equals(CommandType.L_RAINSTOP) ||
                            cmdFlag
                            .Equals(CommandType.L_PETALSTOP))
                        {
                            if (sprites != null)
                            {
                                ISprite[] ss = sprites.GetSprites();

                                for (int i = 0; i < ss.Length; i++)
                                {
                                    ISprite s = ss[i];
                                    if (s is FreedomEffect)
                                    {
                                        if (cmdFlag
                                            .Equals(CommandType.L_SNOWSTOP))
                                        {
                                            if (((FreedomEffect)s).GetKernels()[0] is SnowKernel)
                                            {
                                                sprites.Remove(s);
                                            }
                                        }
                                        else if (cmdFlag
                                                 .Equals(CommandType.L_RAINSTOP))
                                        {
                                            if (((FreedomEffect)s).GetKernels()[0] is RainKernel)
                                            {
                                                sprites.Remove(s);
                                            }
                                        }
                                        else if (cmdFlag
                                                 .Equals(CommandType.L_PETALSTOP))
                                        {
                                            if (((FreedomEffect)s).GetKernels()[0] is PetalKernel)
                                            {
                                                sprites.Remove(s);
                                            }
                                        }
                                    }
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_PLAY))
                        {
                            AssetsSoundManager.GetInstance().PlaySound(mesFlag, false);
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_PLAYLOOP))
                        {
                            AssetsSoundManager.GetInstance().PlaySound(mesFlag, true);
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_PLAYSTOP))
                        {
                            if (NumberUtils.IsNan(mesFlag))
                            {
                                AssetsSoundManager.GetInstance().StopSound(int.Parse(mesFlag));
                            }
                            else
                            {
                                AssetsSoundManager.GetInstance().StopSoundAll();
                            }
                            continue;
                        }

                        if (cmdFlag.Equals(CommandType.L_FADEOUT) ||
                            cmdFlag.Equals(CommandType.L_FADEIN))
                        {
                            scrFlag = true;
                            LColor color = LColor.black;
                            if (mesFlag.Equals("red"))
                            {
                                color = LColor.red;
                            }
                            else if (mesFlag.Equals("yellow"))
                            {
                                color = LColor.yellow;
                            }
                            else if (mesFlag.Equals("white"))
                            {
                                color = LColor.white;
                            }
                            else if (mesFlag.Equals("black"))
                            {
                                color = LColor.black;
                            }
                            else if (mesFlag.Equals("cyan"))
                            {
                                color = LColor.cyan;
                            }
                            else if (mesFlag.Equals("green"))
                            {
                                color = LColor.green;
                            }
                            else if (mesFlag.Equals("orange"))
                            {
                                color = LColor.orange;
                            }
                            else if (mesFlag.Equals("pink"))
                            {
                                color = LColor.pink;
                            }
                            if (sprites != null)
                            {
                                sprites.RemoveAll();
                                if (cmdFlag.Equals(CommandType.L_FADEIN))
                                {
                                    sprites.Add(FadeEffect.GetInstance(
                                                    FadeEffect.TYPE_FADE_IN, color));
                                }
                                else
                                {
                                    sprites.Add(FadeEffect.GetInstance(
                                                    FadeEffect.TYPE_FADE_OUT, color));
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_SELLEN))
                        {
                            if (mesFlag != null)
                            {
                                if (NumberUtils.IsNan(mesFlag))
                                {
                                    select.SetLeftOffset(int.Parse(mesFlag));
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_SELTOP))
                        {
                            if (mesFlag != null)
                            {
                                if (NumberUtils.IsNan(mesFlag))
                                {
                                    select.SetTopOffset(int.Parse(mesFlag));
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_MESLEN))
                        {
                            if (mesFlag != null)
                            {
                                if (NumberUtils.IsNan(mesFlag))
                                {
                                    message.SetMessageLength(int
                                                             .Parse(mesFlag));
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_MESTOP))
                        {
                            if (mesFlag != null)
                            {
                                if (NumberUtils.IsNan(mesFlag))
                                {
                                    message.SetTopOffset(int.Parse(mesFlag));
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_MESLEFT))
                        {
                            if (mesFlag != null)
                            {
                                if (NumberUtils.IsNan(mesFlag))
                                {
                                    message.SetLeftOffset(int.Parse(mesFlag));
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_MESCOLOR))
                        {
                            if (mesFlag != null)
                            {
                                if (mesFlag.Equals("red"))
                                {
                                    message.SetFontColor(LColor.red);
                                }
                                else if (mesFlag.Equals("yellow"))
                                {
                                    message.SetFontColor(LColor.yellow);
                                }
                                else if (mesFlag.Equals("white"))
                                {
                                    message.SetFontColor(LColor.white);
                                }
                                else if (mesFlag.Equals("black"))
                                {
                                    message.SetFontColor(LColor.black);
                                }
                                else if (mesFlag.Equals("cyan"))
                                {
                                    message.SetFontColor(LColor.cyan);
                                }
                                else if (mesFlag.Equals("green"))
                                {
                                    message.SetFontColor(LColor.green);
                                }
                                else if (mesFlag.Equals("orange"))
                                {
                                    message.SetFontColor(LColor.orange);
                                }
                                else if (mesFlag.Equals("pink"))
                                {
                                    message.SetFontColor(LColor.pink);
                                }
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_MES))
                        {
                            if (select.IsVisible())
                            {
                                select.SetVisible(false);
                            }
                            scrFlag = true;
                            string nMessage = mesFlag;
                            message.SetMessage(StringUtils.Replace(nMessage, "&",
                                                                   " "));
                            message.SetVisible(true);
                            break;
                        }
                        if (cmdFlag.Equals(CommandType.L_MESSTOP))
                        {
                            scrFlag = true;
                            message.SetVisible(false);
                            select.SetVisible(false);
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_SELECT))
                        {
                            selectMessage = mesFlag;
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_SELECTS))
                        {
                            if (message.IsVisible())
                            {
                                message.SetVisible(false);
                            }
                            select.SetVisible(true);
                            scrFlag         = true;
                            isSelectMessage = true;
                            string[] selects = command.GetReads();
                            select.SetMessage(selectMessage, selects);
                            break;
                        }
                        if (cmdFlag.Equals(CommandType.L_SHAKE))
                        {
                            scrCG.shakeNumber = int.Parse(mesFlag);
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_CGWAIT))
                        {
                            scrFlag = false;
                            break;
                        }
                        if (cmdFlag.Equals(CommandType.L_SLEEP))
                        {
                            scrCG.sleep    = int.Parse(mesFlag);
                            scrCG.sleepMax = int.Parse(mesFlag);
                            scrFlag        = false;
                            break;
                        }
                        if (cmdFlag.Equals(CommandType.L_FLASH))
                        {
                            scrFlag = true;
                            string[] colors = null;
                            if (mesFlag != null)
                            {
                                colors = StringUtils.Split(mesFlag, ",");
                            }
                            else
                            {
                                colors = new string[] { "0", "0", "0" };
                            }
                            if (color == null && colors != null &&
                                colors.Length == 3)
                            {
                                color = new LColor(int.Parse(colors[0])
                                                   , int.Parse(colors[1])
                                                   , int.Parse(colors[2])
                                                   );
                                scrCG.sleep    = 20;
                                scrCG.sleepMax = scrCG.sleep;
                                scrFlag        = false;
                            }
                            else
                            {
                                color = null;
                            }

                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_GB))
                        {
                            if (mesFlag == null)
                            {
                                return;
                            }
                            if (mesFlag.Equals("none"))
                            {
                                scrCG.NoneBackgroundCG();
                            }
                            else
                            {
                                scrCG.SetBackgroundCG(mesFlag);
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_CG))
                        {
                            if (mesFlag == null)
                            {
                                return;
                            }
                            if (scrCG != null &&
                                scrCG.Count() > LSystem.DEFAULT_MAX_CACHE_SIZE)
                            {
                                scrCG.Dispose();
                            }
                            if (mesFlag.Equals(CommandType.L_DEL))
                            {
                                if (orderFlag != null)
                                {
                                    scrCG.Remove(orderFlag);
                                }
                                else
                                {
                                    scrCG.Dispose();
                                }
                            }
                            else if (lastFlag != null &&
                                     CommandType.L_TO.Equals(orderFlag))
                            {
                                scrCG.Replace(mesFlag, lastFlag);
                            }
                            else
                            {
                                int x = 0, y = 0;
                                if (orderFlag != null)
                                {
                                    x = int.Parse(orderFlag);
                                }
                                if (size >= 4)
                                {
                                    y = int.Parse((string)commands[3]);
                                }
                                int    tx   = x;
                                int    ty   = y;
                                string name = mesFlag;
                                scrCG.Add(name, tx, ty, GetWidth(), GetHeight());
                            }
                            continue;
                        }
                        if (cmdFlag.Equals(CommandType.L_EXIT))
                        {
                            scrFlag = true;
                            SetFPS(LSystem.DEFAULT_MAX_FPS);
                            running = false;
                            OnExit();
                            break;
                        }
                    }
                }
            }
        }
예제 #3
0
 public AssetsSoundManager GetAssetsSound()
 {
     if (this.asm == null)
     {
         this.asm = AssetsSoundManager.GetInstance();
     }
     return asm;
 }