Пример #1
0
        /// <summary>
        /// Check if the req allow it
        /// </summary>
        /// <param name="player"></param>
        /// <param name="final"></param>
        /// <returns>true=can use it, false=not possible</returns>
        public bool Check(Player player, bool final = false)
        {
            foreach (var req in reqs)
            {
                //can use it?
                BaseReq r = OLib.GetReq(req[0]);
                if (!r.Check(player, req[1]) && (r.Final(player, req[1]) || !final))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Check if the req allow it
        /// </summary>
        /// <param name="player"></param>
        /// <param name="onMap"></param>
        /// <param name="pos"></param>
        /// <param name="final"></param>
        /// <returns>true=can use it, false=not possible</returns>
        public bool Check(Player player, MapElementInfo onMap, NVector pos, bool final = false)
        {
            foreach (var req in reqs)
            {
                //can use it?
                BaseReq r = OLib.GetReq(req[0]);
                if (!r.Check(player, onMap, req[1], pos) && (r.Final(player, onMap, req[1], pos) || !final))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #3
0
        /// <summary>
        /// Return the description, why the check its not working
        /// </summary>
        /// <param name="player"></param>
        /// <param name="reqs"></param>
        /// <param name="onMap"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns>the error message or null</returns>
        public static string Desc(Player player, Dictionary <string, string> reqs)
        {
            foreach (KeyValuePair <string, string> req in reqs)
            {
                BaseReq br = OLib.GetReq(req.Key);

                //can use it?
                if (!br.Check(player, req.Value))
                {
                    return(br.Desc(player, req.Value));
                }
            }

            return(null);
        }
Пример #4
0
        /// <summary>
        /// Return the description, why the check its not working or null
        /// </summary>
        /// <param name="player"></param>
        /// <param name="reqs"></param>
        /// <param name="onMap"></param>
        /// <param name="pos"></param>
        /// <returns>the error message or null</returns>
        public static string Desc(Player player, Dictionary <string, string> reqs, MapElementInfo onMap, NVector pos)
        {
            foreach (KeyValuePair <string, string> req in reqs)
            {
                BaseReq br = OLib.GetReq(req.Key);

                //can use it?
                if (!br.Check(player, onMap, req.Value, pos))
                {
                    return(br.Desc(player, onMap, req.Value, pos));
                }
            }

            return(null);
        }
Пример #5
0
        /// <summary>
        /// Return the description, why the check its not working or null
        /// </summary>
        /// <param name="player"></param>
        /// <param name="reqs"></param>
        /// <param name="onMap"></param>
        /// <param name="pos"></param>
        /// <returns>the error message or null</returns>
        public string Desc(Player player, MapElementInfo onMap, NVector pos)
        {
            foreach (var req in reqs)
            {
                BaseReq br = OLib.GetReq(req[0]);

                //can use it?
                if (!br.Check(player, onMap, req[1], pos))
                {
                    return(br.Desc(player, onMap, req[1], pos));
                }
            }

            return(null);
        }
Пример #6
0
        /// <summary>
        /// Return the description, why the check its not working
        /// </summary>
        /// <param name="player"></param>
        /// <returns>the error message or null</returns>
        public string Desc(Player player)
        {
            foreach (var req in reqs)
            {
                BaseReq br = OLib.GetReq(req[0]);

                //can use it?
                if (!br.Check(player, req[1]))
                {
                    return(br.Desc(player, req[1]));
                }
            }

            return(null);
        }
Пример #7
0
        public void BuildPanel(PanelBuilder panel, string title, MapElementInfo onMap, NVector pos)
        {
            try
            {
                //addHeader
                if (reqs.Count == 0)
                {
                    return;
                }

                panel.AddHeaderLabel(title);

                //add req
                foreach (var req in reqs)
                {
                    BaseReq r = OLib.GetReq(req[0]);
                    panel.AddImageLabel(r.Desc(S.ActPlayer(), onMap, req[1], pos), r.Check(S.ActPlayer(), onMap, req[1], pos));
                }
            }
            catch (Exception e)
            {
                ExceptionHelper.ShowException(e);
            }
        }