Пример #1
0
        public void Stop()
        {
            m_GameState = FSPGameState.None;

            if (m_Client != null)
            {
                m_Client.Close();
                m_Client = null;
            }

            if (m_FrameCtrl != null)
            {
                m_FrameCtrl.Close();
                m_FrameCtrl = null;
            }

            m_FrameListener = null;
            m_FrameBuffer.Clear();
            m_IsRunning = false;

            onGameBegin    = null;
            onRoundBegin   = null;
            onControlStart = null;
            onGameEnd      = null;
            onRoundEnd     = null;
        }
Пример #2
0
    /// <summary>
    /// 通过秒转换为中文时间格式
    /// </summary>
    public static String formatDuring(double mss)
    {
        int days    = (int)(mss / (60 * 60 * 24));
        int hours   = (int)((mss % (60 * 60 * 24)) / (60 * 60));
        int minutes = (int)((mss % (60 * 60)) / 60);
        int seconds = (int)(mss % 60);
        DictionaryEx <string, int> time = new DictionaryEx <string, int>();

        if (days != 0)
        {
            time.Add("days", days);
        }
        if (hours != 0)
        {
            time.Add("hours", hours);
        }
        if (minutes != 0)
        {
            time.Add("minutes", minutes);
        }
        if (seconds != 0)
        {
            time.Add("seconds", seconds);
        }
        string timeText = string.Empty;

        for (int i = 0; i < time.mList.Count; ++i)
        {
            timeText += string.Format(TextManager.GetUIString(time.mList[i].ToString()), time[time.mList[i]]);
        }
        time.Clear();
        return(timeText);
    }
Пример #3
0
 /// <summary>
 /// 释放当前创建的GameInput对象
 /// </summary>
 public static void Release()
 {
     m_MapKeyState.Clear();
     if (m_Instance != null)
     {
         GameObject.Destroy(m_Instance.gameObject);
         m_Instance = null;
     }
     OnVkey = null;
 }
Пример #4
0
 public static void Release()
 {
     mIsInit = false;
     foreach (var pair in mObjectsMap)
     {
         pair.Value.ReleaseInFactory();
         pair.Value.Dispose();
     }
     mObjectsMap.Clear();
     mRecycler.Release();
     mViewRoot = null;
 }
Пример #5
0
 public static void CloseAllUI()
 {
     for (int i = 0; i < m_panelList.mList.Count; ++i)
     {
         GameObject.Destroy(m_panelList[m_panelList.mList[i]].gameObject);
     }
     for (int i = 0; i < m_panelExitList.mList.Count; ++i)
     {
         GameObject.Destroy(m_panelExitList[m_panelExitList.mList[i]].gameObject);
     }
     m_panelList.Clear();
     m_panelExitList.Clear();
 }
Пример #6
0
        /// <summary>
        /// 释放工厂创建的所有对象,包括空闲对象
        /// </summary>
        public static void Release()
        {
            m_isInit = false;

            foreach (var pair in m_objMap)
            {
                pair.Value.ReleaseInFactory();
                pair.Value.Dispose();
            }

            m_objMap.Clear();
            m_recycler.Release();
            m_viewRoot = null;
        }
Пример #7
0
        /// <summary>
        /// Finds all contiguous <see cref="Graph"/> nodes within the specified maximum world
        /// distance that are visible from the specified node.</summary>
        /// <param name="isOpaque">
        /// The <see cref="Predicate{T}"/> delegate that determines whether a <see cref="Graph"/>
        /// node blocks the line of sight.</param>
        /// <param name="source">
        /// The source node within <see cref="Graph"/> where the search starts.</param>
        /// <param name="distance"><para>
        /// The maximum world distance from the specified <paramref name="source"/> to search.
        /// </para><para>-or-</para><para>
        /// Zero to search the entire <see cref="Graph"/>. The default is zero.</para></param>
        /// <returns>
        /// <c>true</c> if one or more nodes are visible from <paramref name="source"/> within the
        /// specified <paramref name="distance"/>; otherwise, <c>false</c>.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="isOpaque"/> or <paramref name="source"/> is a null reference.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <paramref name="distance"/> is less than zero.</exception>
        /// <remarks><para>
        /// <b>FindVisible</b> returns <c>false</c> if the specified <paramref name="source"/> node
        /// is invalid, or if there are no visible nodes. Otherwise, <b>FindVisible</b> returns
        /// <c>true</c> and sets the <see cref="Nodes"/> and <see cref="NodeArcs"/> properties to
        /// the result of the visibility search.
        /// </para><para>
        /// All nodes within the specified maximum <paramref name="distance"/> are considered
        /// visible, except for those that are obscured by a node for which <paramref
        /// name="isOpaque"/> succeeds, as described for the <see cref="Visibility{T}"/> class.
        /// </para><para>
        /// If <paramref name="distance"/> is positive, any visible node must be reachable by a path
        /// that only includes other nodes within <paramref name="distance"/>; otherwise, it will
        /// not be found. This condition holds for any <see cref="PolygonGrid"/>, and for any <see
        /// cref="Subdivision"/> that was created from a Delaunay triangulation.</para></remarks>

        public bool FindVisible(Predicate <T> isOpaque, T source, double distance = 0)
        {
            if (isOpaque == null)
            {
                ThrowHelper.ThrowArgumentNullException("isOpaque");
            }
            if (source == null)
            {
                ThrowHelper.ThrowArgumentNullException("source");
            }
            if (distance < 0)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(
                    "distance", distance, Strings.ArgumentNegative);
            }

            // clear previous results
            _nodes.Clear();
            _nodeArcs.Clear();

            // fail if source node is invalid
            if (!Graph.Contains(source))
            {
                return(false);
            }

            _isOpaque = isOpaque;
            _source   = source;
            _distance = distance;

            // compute world coordinates of source node
            _sourceWorld = Graph.GetWorldLocation(source);

            // expand visibility area from source
            FindObscuringNodes(source);
            FindVisibleNodes();

            // clear intermediate data
            _isOpaque = null;
            _source   = default(T);
            _obscuringNodes.Clear();

            // succeed if any nodes reached
            return(_nodes.Count > 0);
        }
Пример #8
0
 public void Clear()
 {
     ClearForNull();
     _wrapped.Clear();
 }
Пример #9
0
 protected override void OnUnload()
 {
     storeList.Clear();
 }