private void PointDown() { m_ChainInfo.StartStronghold = null; m_ChainInfo.EndStronghold = null; if (m_ChainInfo.LineList == null) { m_ChainInfo.LineList = new List <Line>(); } m_ChainInfo.LineList.Clear(); //第一个点 m_Line = null; m_LineOrigin = null; Cell c = GetCell(Input.mousePosition); if (c != null) { Stronghold s = c.GetStronghold(); if (s != null) { if (!s.HasConnectStronghold()) { bool isOk = true; if (GameLevelSceneCtrl.Instance.IsGuide) { if (GameLevelSceneCtrl.Instance.ContainsGuideObj(c.gameObject)) { isOk = true; } else { isOk = false; } } if (isOk) { GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.Item, "Building/Line", isCache: true, isClone: true); m_Line = go.GetComponent <Line>(); m_Line.AddCell(c); m_LineOrigin = c; m_Line.Parent = null; m_ChainInfo.Start(s, OnValidLineCountChange); m_ChainInfo.AddLine(m_Line); EazySoundManager.PlaySound(ClickStronghold); } } else { ChainInfo info = m_AllChainInfo.Find(x => x.StartStronghold == s || x.EndStronghold == s); if (!info.IsEmpty()) { m_AllChainInfo.Remove(info); info.Destory(); } } } } }
private void PointUp() { if (!m_ChainInfo.IsEmpty()) { if (m_ChainInfo.EndStronghold == null) { m_ChainInfo.Destory(); } } OnValidLineCountChange(-1); }