示例#1
0
    public override void Initialize()
    {
        GameStart.SetActive(false);
        GameOver.SetActive(false);
        LevelUp.SetActive(false);

        playUI.SetActive(true);
        chooseFrame.SetActive(false);
        GaugeTime = 0;
        curTime   = 0;
        StartCoroutine(SetFoods());

        b_Touchdown  = false;
        b_Changing   = false;
        b_StartGauge = false;
        b_CanMove    = false;
        gauge.transform.localScale = Vector3.one;
        time = 0;
        SoundManager.soundMgr.audioSource.Stop();
        SoundManager.soundMgr.PlayES("Intro");
        DataManager.curScore = 0;

        pilot.SetBool("GameOver", false);
        b_GameOver = false;

        StartCoroutine(GameStartAnim());

        curLevel = LEVEL.LEVEL1;
    }
示例#2
0
        private static void Print(LEVEL level, string tag, string message, Exception exception)
        {
            StringBuilder messageBuilder = new StringBuilder();

            messageBuilder.Append(DateTime.Now.ToString(timeFormat))
            .Append(" ")
            .Append(Thread.CurrentThread.ManagedThreadId)
            .Append("-")
            .Append(currentProcess.Id)
            // OSX 系统上不支持
            // .Append("/")
            // .Append(currentProcess.ProcessName)
            .Append(" ")
            .Append(level.ToString())
            .Append("/")
            .Append(tag)
            .Append(": ")
            .Append(message);
            if (exception != null)
            {
                messageBuilder.Append("\n Exception:\n")
                .Append(exception.ToString());
            }
            messageBuilder.Append("\r\n");
            foreach (Log log in logImplList)
            {
                log.PrintLog(messageBuilder.ToString());
            }
        }
示例#3
0
        public Logger(string id, string location, LEVEL level = LEVEL.ALL)
            : base(id, level)
        {
            DirectoryInfo ldi_info = null;

            if (string.IsNullOrWhiteSpace(location))
            {
                var lfi_module = new FileInfo(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
                ldi_info = lfi_module.Directory;
                var ls_root = Path.Combine(ldi_info.FullName, "log");
                if (!Directory.Exists(ls_root))
                {
                    Directory.CreateDirectory(ls_root);
                }
                ldi_info = new DirectoryInfo(ls_root);
            }
            else
            {
                ldi_info = new DirectoryInfo(location);
            }
            if (ldi_info == null || !ldi_info.Exists)
            {
                throw new Exception(string.Format(Message.MSG_ERR_PARM_IS_INVALID, "location", location));
            }
            path = ldi_info.FullName;
        }
        /// <summary>
        /// ログ出力
        ///     WARNING 以上はコンソールの色を変えて表示
        /// </summary>
        /// <param name="level">ログレベル</param>
        /// <param name="message">メッセージ</param>
        /// <param name="notice">メッセージボックスの表示の有無(デフォルトはfalse)</param>
        public static void Log(LEVEL level, string message, bool notice = false)
        {
            if (LEVEL.REPORT == level)
            {
                Console.WriteLine(message);
            }
            else
            {
                if (OutputBorderLevel >= level)
                {
                    if (LEVEL.WARNING >= level)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.BackgroundColor = ConsoleColor.White;
                        Console.WriteLine("[" + level.ToString() + "] " + message);
                        Console.ResetColor();// 色のリセット

                        /*
                         * if (notice)
                         * {
                         *  MessageBox.Show("[" + level.ToString() + "] " + Environment.NewLine + Environment.NewLine +
                         *                 "    " + message,
                         *                 System.Windows.Forms.Application.ProductName + " Ver." + System.Windows.Forms.Application.ProductVersion,
                         *                 MessageBoxButtons.OK,
                         *                 MessageBoxIcon.Error);
                         * }
                         */
                    }
                    else
                    {
                        Console.WriteLine(message);
                    }
                }
            }
        }
示例#5
0
 public LogItem(string message, LEVEL level)
 {
     Message          = message;
     Level            = level;
     Time             = DateTime.Now;
     MessageFormatted = $"[{Time}] {Message}";
 }
示例#6
0
文件: API.cs 项目: outrera/SkyOfSteel
    public static List <List <object> > Expose(LEVEL ApiLevel, Scripting ScriptingRef)
    {
        List <List <object> > Output = new List <List <object> >();

        switch (ApiLevel)
        {
        case LEVEL.CONSOLE:
            Output.Add(GetDelCall("print"));
            Output.Add(GetDelCall("log"));
            Output.Add(GetDelCall("ms_get"));
            Output.Add(GetDelCall("host"));
            Output.Add(GetDelCall("connect"));
            Output.Add(GetDelCall("disconnect"));
            Output.Add(GetDelCall("peerlist_get"));
            Output.Add(GetDelCall("bind"));
            Output.Add(GetDelCall("unbind"));
            Output.Add(GetDelCall("player_input_forward_set"));
            Output.Add(GetDelCall("player_input_forward_get"));
            Output.Add(GetDelCall("player_input_backward_set"));
            Output.Add(GetDelCall("player_input_backward_get"));
            Output.Add(GetDelCall("player_input_right_set"));
            Output.Add(GetDelCall("player_input_right_get"));
            Output.Add(GetDelCall("player_input_left_set"));
            Output.Add(GetDelCall("player_input_left_get"));
            Output.Add(GetDelCall("player_input_sprint_set"));
            Output.Add(GetDelCall("player_input_sprint_get"));
            Output.Add(GetDelCall("player_input_jump_set"));
            Output.Add(GetDelCall("player_input_jump_get"));
            Output.Add(GetDelCall("player_input_inventory_up"));
            Output.Add(GetDelCall("player_input_inventory_down"));
            Output.Add(GetDelCall("player_input_look_up"));
            Output.Add(GetDelCall("player_input_look_down"));
            Output.Add(GetDelCall("player_input_look_right"));
            Output.Add(GetDelCall("player_input_look_left"));
            Output.Add(GetDelCall("player_input_build_rotate"));
            Output.Add(GetDelCall("player_input_primary_fire"));
            Output.Add(GetDelCall("player_input_secondary_fire"));
            Output.Add(GetDelCall("gamemode_set"));
            Output.Add(GetDelCall("gamemode_get"));
            Output.Add(GetDelCall("chunk_render_distance_set"));
            Output.Add(GetDelCall("chunk_render_distance_get"));
            Output.Add(GetDelCall("save"));
            Output.Add(GetDelCall("load"));
            break;

        case LEVEL.SERVER_GM:
            Output.Add(GetDelCall("log"));
            Output.Add(GetDelCall("ms_get"));
            Output.Add(GetDelCall("peerlist_get"));
            break;

        case LEVEL.CLIENT_GM:
            Output.Add(GetDelCall("log"));
            Output.Add(GetDelCall("ms_get"));
            Output.Add(GetDelCall("peerlist_get"));
            break;
        }

        return(Output);
    }
示例#7
0
    void    Start()
    {
        switch (GlobalParam.GetInstance().difficulty())
        {
        case 0:
        {
            this.level = LEVEL.EASY;
        }
        break;

        case 1:
        {
            this.level = LEVEL.NORMAL;
        }
        break;

        case 2:
        {
            this.level = LEVEL.HARD;
        }
        break;

        default:
        {
            this.level = LEVEL.EASY;
        }
        break;
        }
    }
示例#8
0
 public List <AbsentLogModel> GetBy(LEVEL levelentity, COURSE courseentity)
 {
     try
     {
         List <AbsentLogModel> logs =
             (from a in
              repository.GetBy <VW_ABSENT_LOG>(
                  a =>
                  a.Course_Id == courseentity.Id && a.Level_Id == levelentity.Id && a.Activated)
              select new AbsentLogModel
         {
             Id = a.Id,
             Name = a.Last_Name + " " + a.First_Name + a.Other_Name,
             DepartmentId = a.Department_Id,
             ProgrammeId = a.Programme_Id,
             LevelId = a.Level_Id,
             Duration = a.Duration_In_Days,
             StartDate = a.Start_Date.ToLongDateString(),
             EndDate = a.End_Date.ToLongDateString(),
             Accept = (bool)a.Approved,
             RejectReason = string.IsNullOrEmpty(a.Reject_Reason) ? " " : a.Reject_Reason,
             Remark = string.IsNullOrEmpty(a.Remark) ? " " : a.Remark,
             DepartmentName = a.Department_Name,
             ProgrammeName = a.Programme_Name,
             LevelName = a.Level_Name
         }).ToList();
         return(logs);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public JsonResult GetAbsentRecord(string level, string course)
        {
            try
            {
                if (string.IsNullOrEmpty(level) && string.IsNullOrEmpty(course))
                {
                    return(null);
                }
                AbsentLogLogic        absentLogLogic = new AbsentLogLogic();
                List <AbsentLogModel> absentLogs     = new List <AbsentLogModel>();

                LEVEL levelentity = new LEVEL {
                    Id = Convert.ToInt32(level)
                };
                COURSE courseentity = new COURSE()
                {
                    Id = Convert.ToInt32(course)
                };

                absentLogs = absentLogLogic.GetBy(levelentity, courseentity);

                return(Json(absentLogs, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                throw;
            }
            return(null);
        }
示例#10
0
        private TraceEventType getFromTypeAnalyzer(LEVEL type)
        {
            TraceEventType t = TraceEventType.Information;

            if (type == LEVEL.CRITICAL)
            {
                t = TraceEventType.Critical;
            }

            if (type == LEVEL.INFO)
            {
                t = TraceEventType.Information;
            }

            if (type == LEVEL.ERROR)
            {
                t = TraceEventType.Error;
            }

            if (type == LEVEL.WARNING)
            {
                t = TraceEventType.Warning;
            }

            if (type == LEVEL.VERBOSE)
            {
                t = TraceEventType.Verbose;
            }

            return(t);
        }
示例#11
0
    public void writeMessage(string message, LEVEL l)
    {
        string curText = textBox.text;

        if (currentMessages >= MAX_MESSAGES)
        {
            // Need to delete a line at start
            curText = curText.Substring(curText.IndexOf('\n', 1));
        }
        else
        {
            currentMessages++;
        }
        switch (l)
        {
        case LEVEL.ERROR:
            curText += "<color=" + ERROR_TEXT_COLOR + ">" + message + "</color>";
            break;

        case LEVEL.WARNING:
            curText += "<color=" + WARN_TEXT_COLOR + ">" + message + "</color>";
            break;

        case LEVEL.COMMAND:
            curText += "<color=" + COMMAND_TEXT_COLOR + ">" + message + "</color>";
            break;

        case LEVEL.INFO:
        default:
            curText += "<color=" + INFO_TEXT_COLOR + ">" + message + "</color>";
            break;
        }
        textBox.text = curText + "\n";
    }
示例#12
0
        private State FilterState(State correntState, State preState)
        {
            correntState.NodeList.RemoveAll(delegate(GraphNode node)
            {
                return(!LocalMatchRule(preState, node));
            });
            if (correntState.NodeList.Count() == 0)
            {
                correntState.MaxStateLEVEL = LEVEL.Uncertainty;
                correntState.MinStateLEVEL = LEVEL.Uncertainty;
                correntState.NodeCount     = 0;
                correntState.NodeList      = null;
            }
            else
            {
                //--------------------TODO   not effective
                LEVEL min = correntState.NodeList.First().NodeLEVEL;
                LEVEL max = correntState.NodeList.First().NodeLEVEL;

                foreach (GraphNode node in correntState.NodeList)
                {
                    min = min < node.NodeLEVEL ? min : node.NodeLEVEL;
                    max = max > node.NodeLEVEL ? max : node.NodeLEVEL;
                }

                correntState.MaxStateLEVEL = max;
                correntState.MinStateLEVEL = min;
                correntState.NodeCount     = correntState.NodeList.Count();
            }
            return(correntState);
        }
示例#13
0
        /**
         */
        static public String[] getLatestLines(LEVEL level, int amount)
        {
            List <String> result = new List <String>();
            int           loop   = logEntries.Count;
            int           items  = 0;

            amount = Math.Max(amount, 1);

            // loop through the items in the list
            // starting at the last and working 'downwards'
            // end the loop until we have 10 entries or search the end of the list
            while (items < Math.Min(amount, logEntries.Count) && loop > 0)
            {
                // reduce our loop iterator
                loop--;

                // if the logging level of this entry is the same or higher than our threshold...
                if (logEntries[loop].Key >= level)
                {
                    // add the entry to our result list
                    result.Add(logEntries[loop].Value);
                    items++;
                }
            }

            // reverse the order to avoid our text showing up in the wrong order
            result.Reverse();

            // return
            return(result.ToArray());
        }
示例#14
0
        /// <summary>
        /// Find node with specific name in HashTable
        /// </summary>
        /// <param name="name">name of node</param>
        /// <returns>query state</returns>
        public State FindNodeInHashTable(string name)
        {
            State state = new State();

            if (AddrGraph.NodeTable[name] == null)
            {
                state.Name          = name;
                state.MaxStateLEVEL = LEVEL.Uncertainty;
                state.MinStateLEVEL = LEVEL.Uncertainty;
                state.NodeCount     = 0;
                state.NodeList      = null;
                return(state);
            }
            TableNode node = AddrGraph.NodeTable[name] as TableNode;
            LEVEL     min  = node.GNode.NodeLEVEL;
            LEVEL     max  = node.GNode.NodeLEVEL;

            state.NodeList.Add(node.GNode);
            int i = 1;

            while (node.Next != null)
            {
                min = min < node.Next.GNode.NodeLEVEL ? min : node.Next.GNode.NodeLEVEL;
                max = max > node.Next.GNode.NodeLEVEL ? max : node.Next.GNode.NodeLEVEL;
                state.NodeList.Add(node.Next.GNode);
                node = node.Next;
                i++;
            }
            state.Name      = name;
            state.NodeCount = i;

            return(state);
        }
示例#15
0
 public GraphNode(string name, LEVEL level, List<GraphNode> nextNodeList)
 {
     string _id = System.Guid.NewGuid().ToString();
     _name = name;
     _nodelevel = level;
     NextNodeList = nextNodeList;
 }
示例#16
0
 /// <summary>-------
 /// <para>The log method to write a message to the log file</para>
 /// </summary>
 /// <param name="level">is the LEVEL object used to identify the type of message. Use "Logger.TYPE.*" to choose the log level</param>
 /// <param name="message">is the text of message</param>
 public void log(LEVEL level, String message)
 {
     if (message == null)
     {
         message = "";
     }
     lock (m_lock)
     {
         if (canLog(level))
         {
             if (log_enable)
             {
                 LOG_ID++;
                 if (LOG_ID == 99999)
                 {
                     LOG_ID = 0;
                 }
                 mySource.TraceEvent(getFromTypeAnalyzer(level), LOG_ID, message);
                 using (StreamWriter w = File.AppendText(fileName))
                 {
                     w.WriteLine(getLine(level, LOG_ID, message));
                 }
             }
         }
     }
 }
示例#17
0
 public void Log(LEVEL level, string[] prefix, object obj, UnityEngine.Object context = null)
 {
     string[] newPrefix = new string[prefix.Length + 1];
     newPrefix[0] = this.prefix;
     Array.Copy(prefix, 0, newPrefix, 1, prefix.Length);
     Parent.Log(level, newPrefix, obj, context);
 }
        /// <summary>
        /// Log message according to LogLevel
        /// </summary>
        /// <param name="LogLevel"></param>
        /// <param name="Message"></param>
        private void Log(LEVEL LogLevel, string Message)
        {
            string PreText;

            switch (LogLevel)
            {
            case LEVEL.INFO:
                PreText = DateTime.Now.ToString(dateTimeFormat) + " [INFO] ";
                break;

            case LEVEL.DEBUG:
                PreText = DateTime.Now.ToString(dateTimeFormat) + " [DEBUG] ";
                break;

            case LEVEL.WARN:
                PreText = DateTime.Now.ToString(dateTimeFormat) + " [WARN]  ";
                break;

            case LEVEL.ERROR:
                PreText = DateTime.Now.ToString(dateTimeFormat) + " [ERROR] ";
                break;

            case LEVEL.FATAL:
                PreText = DateTime.Now.ToString(dateTimeFormat) + " [FATAL] ";
                break;

            default: PreText = ""; break;
            }

            WriteLine(PreText + Message);
        }
示例#19
0
        private static void WriteConsoleColored(LEVEL level, string line)
        {
            lock (ConsoleWriteLock)
            {
                var ColorBefore = Console.ForegroundColor;

                try
                {
                    switch (level)
                    {
                    case LEVEL.WARNING:
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        break;

                    case LEVEL.ERROR:
                        Console.ForegroundColor = ConsoleColor.Red;
                        break;
                    }

                    Console.Error.WriteLine(line);
                }
                catch (Exception Lex)
                {
                    Console.Error.WriteLine("Exception occured writing a logline");
                    Console.Error.WriteLine(Lex.Message);
                    Console.Error.WriteLine(Lex.StackTrace);
                }
                finally
                {
                    Console.ForegroundColor = ColorBefore;
                }
            }
        }
示例#20
0
        internal static void Write(string message, LEVEL level)
        {
            switch (level)
            {
            case LEVEL.ERROR:
                Error(message);
                return;

            case LEVEL.DETAIL:
                Detail(message);
                return;

            case LEVEL.WARNING:
                Warning(message);
                return;

            case LEVEL.INFO:
                Info(message);
                return;

            case LEVEL.PERFORMANCE:
                UnityEngine.Debug.Log("[PERF] " + message);
                return;
            }
            UnityEngine.Debug.Log(message);
        }
示例#21
0
        public override void SetContent()
        {
            bool isRunning = true;

            while (isRunning)
            {
                Console.WriteLine("[0] A1\n[1] A2\n[2] B1\n[3] B2\n[4] C1\n[5] C2");
                Console.WriteLine("Enter the level: ");

                string input     = Console.ReadKey(true).KeyChar.ToString().ToLower();
                int    level_int = 0;
                bool   isNumber  = Int32.TryParse(input, out level_int);

                if (isNumber && level_int < 6 && level_int >= 0)
                {
                    LEVEL level_en = (LEVEL)Enum.ToObject(typeof(LEVEL), level_int);
                    data.PrintByLevel(level_en);
                    Console.WriteLine("Input: " + level_int);
                }
                else
                {
                    isRunning = false;
                }
            }
        }
示例#22
0
        void LogMessage(LEVEL msgLevel, string format, params object[] msgs)
        {
            if (msgLevel < level)
            {
                return;
            }

            string caller = programName;

            // Debug line formatting
            string line = "{0} [{1}] [{2}]: {3}";

            line = string.Format(line, DateTime.Now.ToString(culture.DateTimeFormat.LongTimePattern), msgLevel.ToString(), caller, string.Format(format, msgs));

            if (outputToConsole)
            {
                Console.ForegroundColor = colors[msgLevel];
                logFunction(line);
            }

            if (outputToFile)
            {
                using (StreamWriter sw = new StreamWriter(logFileStream, Encoding.UTF8, 1024, leaveOpen: true)) {
                    sw.WriteLine(line);
                }
            }
        }
示例#23
0
        /// <summary>
        /// Initialize the class and set the level
        /// </summary>
        /// <param name="title"></param>
        /// <param name="level"></param>
        public Log(string title, LEVEL level)
        {
            VerifyLogPath();

            setTitle(title);
            SetLevel(level);
        }
        public Calculate(setting setting, OutlineRenderFeature render, RenderTargetIdentifier source)
        {
            mysetting     = setting;
            SelectOutline = render;
            sour          = source;
            my_level      = new LEVEL[maxLevel];

            for (int t = 0; t < maxLevel; t++) //申请32个ID的,up和down各16个,用这个id去代替临时RT来使用
            {
                my_level[t] = new LEVEL
                {
                    down = Shader.PropertyToID("_OutlineBlurMipDown" + t),
                    up   = Shader.PropertyToID("_OutlineBlurMipUp" + t)
                };
            }

            if (mysetting.ColorType == TYPE.INcolorON)
            {
                mysetting.mymat.EnableKeyword("_INCOLORON");
                mysetting.mymat.DisableKeyword("_INCOLOROFF");
            }

            else
            {
                mysetting.mymat.EnableKeyword("_INCOLOROFF");
                mysetting.mymat.DisableKeyword("_INCOLORON");
            }
        }
示例#25
0
 public Logger(string category, LEVEL level, Object context)
 {
     this.category = category.ToUpper();
     this.level    = level;
     this.context  = context;
     this.sn       = 0;
     this.showSn   = this.level <= LEVEL.INFO;
 }
示例#26
0
        public GraphNode(string name, LEVEL level, List <GraphNode> nextNodeList)
        {
            string _id = System.Guid.NewGuid().ToString();

            _name        = name;
            _nodelevel   = level;
            NextNodeList = nextNodeList;
        }
        }                                // THE DIFFICULTY USER CHOSE

        public InitialInfo()
        {
            Name       = "";
            Instrument = "";
            Genre      = "";
            Game       = GAME.NONE;
            Level      = LEVEL.NONE;
        }
示例#28
0
        public ObservableCollection <Researcher> FilterResearcherbyLevel(LEVEL level)
        {
            var result = from Researcher r in Researchers
                         where r.Level == level
                         select r;

            return(new ObservableCollection <Researcher>(result.ToList()));
        }
示例#29
0
 public State()
 {
     MaxStateLEVEL = LEVEL.Default;
     MinStateLEVEL = LEVEL.Default;
     NodeList      = new List <GraphNode>();
     NodeCount     = 0;
     Name          = "";
 }
示例#30
0
 public State()
 {
     MaxStateLEVEL = LEVEL.Default;
     MinStateLEVEL = LEVEL.Default;
     NodeList = new List<GraphNode>();
     NodeCount = 0;
     Name = "";
 }
示例#31
0
 protected LogCore(string id, LEVEL level = LEVEL.ALL)
 {
     if (string.IsNullOrWhiteSpace(id))
     {
         throw new Exception(string.Format(Message.MSG_ERR_PARM_IS_NULL_OR_EMPTY, "id"));
     }
     this.id    = id.Trim();
     this.level = level;
 }
示例#32
0
 private bool canLog(LEVEL lev)
 {
     // Get the level of lev
     if (((int)lev) <= ((int)level))
     {
         return(true);
     }
     return(false);
 }
示例#33
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     player = new Player();
     currentLevel = new LEVEL();
     currentLevel = LEVEL.LEVEL1;
     asteroidKillList = new List<Asteroid>();
     asteroid = new List<Asteroid>();
     newAsteroidList = new List<Asteroid>();
     powerUp = new List<PowerUp>();
     powerUpKillList = new List<PowerUp>();
 }
示例#34
0
 private static string TranslateLEVEL(LEVEL level)
 {
     if (level == LEVEL.Building)
     {
         return "Building";
     }
     if (level == LEVEL.City)
     {
         return "City";
     }
     if (level == LEVEL.Contry)
     {
         return "Contry";
     }
     if (level == LEVEL.Other)
     {
         return "Other";
     }
     if (level == LEVEL.Province)
     {
         return "Province";
     }
     if (level == LEVEL.Root)
     {
         return "Root";
     }
     if (level == LEVEL.Street)
     {
         return "Street";
     }
     if (level == LEVEL.Uncertainty)
     {
         return "Uncertainty";
     }
     if (level == LEVEL.Zone)
     {
         return "Zone";
     }
     return "ERROR";
 }
示例#35
0
 public static void SetLevel(LEVEL level)
 {
     UnityEngine.Debug.Log ("log level " + level);
     Log.level = level;
 }
示例#36
0
 private static bool IsLevel(LEVEL level)
 {
     return level == Log.level;
 }
示例#37
0
 public static bool IsLogable(LEVEL level)
 {
     return level <= Log.level;
 }
示例#38
0
 public InsertElement(string name,LEVEL level)
 {
     Name = name;
     Level = level;
     Mode = (UInt16)(InsertMode.AutoLevel | InsertMode.AutoPlace);
 }
示例#39
0
 public InsertElement(string name)
 {
     Name = name;
     Level = LEVEL.Default;
     Mode = (UInt16)(InsertMode.AutoLevel | InsertMode.AutoPlace);
 }
        private bool validateCSVData(string[] csvData)
        {
            bool isValid = true;

            //checking position index 0 for word count
            try
            {
                noOfWords = Int32.Parse(csvData[0]);
            }
            catch (Exception)
            {
                addMessage("Error in CSV File: First position is not a valid word count");
                isValid = false;
                return isValid;
            }

            try
            {
                width = Int32.Parse(csvData[1]);
            }
            catch (Exception)
            {
                addMessage("Error in CSV File: Second position is not a valid Crozzle width");
                isValid = false;
                return isValid;
            }

            try
            {
                height = Int32.Parse(csvData[2]);
            }
            catch (Exception)
            {
                addMessage("Error in CSV File: Third position is not a valid Crozzle height");
                isValid = false;
                return isValid;
            }

            try
            {
                string l = csvData[3];

                if (l == "EASY")
                {
                    level = LEVEL.EASY;
                }
                else if (l == "MEDIUM")
                {
                    level = LEVEL.MEDIUM;
                }
                else if (l == "HARD")
                {
                    level = LEVEL.HARD;
                }
                else if (l == "EXTREME")
                {
                    level = LEVEL.EXTREME;
                }
            }
            catch (Exception)
            {
                addMessage("Error in CSV File: Fourth position is not a valid Crozzle difficulty level");
                isValid = false;
                return isValid;
            }

            if (noOfWords == (csvData.Length - 4))
            {
                wordList = new string[noOfWords];
                for (int i = 0; i < csvData.Length - 4; i++)
                {
                    wordList[i] = csvData[i + 4];
                }
            }
            else
            {
                addMessage("Word count does not match the actual words present on file");
                isValid = false;
                return isValid;
            }
            return isValid;
        }
示例#41
0
 /// <summary>
 /// in the case that place_mode is OldPlace, level_mode must be ExactlyLevel. 
 /// </summary>
 /// <param name="name"></param>
 /// <param name="level"></param>
 /// <param name="mode"></param>
 public InsertElement(string name, LEVEL level, InsertMode mode)
 {
     Name = name;
     Level = level;
     Mode = (UInt16)mode;
 }
示例#42
0
文件: Alert.cs 项目: janeycoops/Test1
 public Alert(String message, LEVEL level)
 {
     m_mess = message;
     m_level = level;
 }
示例#43
0
 public static void SetLevel(LEVEL level)
 {
    Debug.Log("log level "+level);
    Log.level = level;
 }
示例#44
0
 public Boolean IsLevelEnabled(LEVEL aLevel)
 {
     return true;
 }
示例#45
0
        public void Log(LEVEL aLevel, String aMessage)
        {
            Assert.FailIfNull(aLevel, "aLevel");
            Assert.FailIfNull(aMessage, "aMessage");

            if (IsLevelEnabled(aLevel))
            {
                //System.DateTime.Now.ToShortTimeString
            #if !XBOX360
                Console.WriteLine("{0} {1}: {2}", DateTime.Now.ToString("HH:mm:ss"), aLevel, aMessage);
            #endif
            }
        }
示例#46
0
        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            float elapsed = (float)gameTime.ElapsedGameTime.TotalMilliseconds;

            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            player.Update(gameTime);
            player.CheckBoundries(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            foreach (PowerUp p in powerUp)
            {
                if(p.GetHitbox().Intersects(player.GetPlayerHitbox()))
                {
                    powerUpKillList.Add(p);
                }

                p.Update(gameTime);
            }

            foreach (Asteroid ast in asteroid)
            {
                ast.Update(gameTime);
                ast.CheckBoundries(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

                if (player.GetPlayerHitbox().Intersects(ast.GetAsteroidHitbox()))
                {
                    switch (ast.GetSize())
                    {
                        case 1:
                            numOfAsteroids -= 1;
                            Vector2 temp = new Vector2((float)ast.GetXPos(), (float)ast.GetYPos());
                            asteroidKillList.Add(ast);
                            break;
                        case 2:
                            numOfAsteroids -= 1;
                            for (int i = 0; i < 2; i++)
                            {
                                double angle = rnd.NextDouble() * 2 * Math.PI;
                                newAsteroidList.Add(new Asteroid(new Vector2(ast.GetXPos(), ast.GetYPos()), 1, 3.0f, dir = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle))));
                                numOfAsteroids += 1;
                            }
                            asteroidKillList.Add(ast);
                            break;
                        case 3:
                            numOfAsteroids -= 1;
                            for (int i = 0; i < 2; i++)
                            {
                                double angle = rnd.NextDouble() * 2 * Math.PI;
                                newAsteroidList.Add(new Asteroid(new Vector2(ast.GetXPos(), ast.GetYPos()), 2, 3.0f,  dir = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle))));
                                numOfAsteroids += 1;
                            }
                            asteroidKillList.Add(ast);
                            break;
                        default:
                            System.Windows.Forms.MessageBox.Show("Oeps");
                            break;
                    }
                }
            }

            foreach (Asteroid a in newAsteroidList)
            {
                asteroid.Add(a);
            }

            foreach (Asteroid a in asteroidKillList)
            {
                asteroid.Remove(a);
            }

            foreach (PowerUp p in powerUpKillList)
            {
                powerUp.Remove(p);
            }

            asteroidKillList.Clear();
            newAsteroidList.Clear();
            powerUpKillList.Clear();

            if (numOfAsteroids == 0)
            {
                switch (currentLevel)
                {
                    case LEVEL.LEVEL1:
                        currentLevel = LEVEL.LEVEL2;
                        InitializeNewLevel();
                        break;
                    case LEVEL.LEVEL2:
                        currentLevel = LEVEL.LEVEL3;
                        InitializeNewLevel();
                        break;
                    case LEVEL.LEVEL3:
                        currentLevel = LEVEL.LEVEL4;
                        InitializeNewLevel();
                        break;
                    case LEVEL.LEVEL4:
                        System.Windows.Forms.MessageBox.Show("You win!");
                        break;
                    default:
                        break;
                }
            }
        }