示例#1
0
        public static ArenaSetting Load(string path)
        {
            ArenaSetting asetting = new ArenaSetting();

            if (File.Exists(path))
            {
                FileStream stream = File.OpenRead(path);
                asetting = (ArenaSetting)serializer.Deserialize(stream);
                stream.Close();
            }
            else
            {
                asetting.Save(path);
            }

            return(asetting);
        }
示例#2
0
        protected void SetPrepare(CommandArgs args)
        {
            if (args.Player.Group.ContainsGroup("superadmin"))
            {
                if (args.Parameters.Count == 0)
                {
                    args.Player.SendInfoMessage("You must specify team index [1|2] after /asetprepare");
                }
                else
                {
                    int teamid = int.MinValue;
                    int.TryParse(args.Parameters[0], out teamid);

                    if (teamid == 1)
                    {
                        Setting.TeamPrepare1.X = args.Player.TileX;
                        Setting.TeamPrepare1.Y = args.Player.TileY;
                        args.Player.SendInfoMessage(String.Format("Arena: Team 1 Prepare position set at : [{0}, {1}]", Setting.TeamPrepare1.X, Setting.TeamPrepare1.Y));
                        Setting.Save(ArenaSettingFile);
                    }
                    else if (teamid == 2)
                    {
                        Setting.TeamPrepare2.X = args.Player.TileX;
                        Setting.TeamPrepare2.Y = args.Player.TileY;
                        args.Player.SendInfoMessage(String.Format("Arena: Team 2 Prepare position set at : [{0}, {1}]", Setting.TeamPrepare2.X, Setting.TeamPrepare2.Y));
                        Setting.Save(ArenaSettingFile);
                    }
                    else
                    {
                        args.Player.SendErrorMessage("Arena: Invalid team id!");
                    }
                }
            }
            else
            {
                args.Player.SendErrorMessage("Only superadmin can use this command!");
            }
        }
示例#3
0
        public static ArenaSetting Load(string path)
        {
            ArenaSetting asetting = new ArenaSetting();

            if(File.Exists(path))
            {

                FileStream stream = File.OpenRead(path);
                asetting = (ArenaSetting)serializer.Deserialize(stream);
                stream.Close();
            }
            else
            {
                asetting.Save(path);
            }

            return asetting;
        }