static void ResetIdInRing(List <CellObjCtrl> ringObjs) { foreach (CellObjCtrl cctrl in ringObjs) { CCRing cring = cctrl.GetComponentInChildren <CCRing> (); cring.ResetIdInRing(); } }
static void AddIdInRing(List <CellObjCtrl> ringObjs) { for (int i = 0; i < ringObjs.Count; i++) { CCRing cring = ringObjs [i].GetComponentInChildren <CCRing> (); cring._IdInRing = i; } }
public void TurnRing(bool bON) { if (bON) { CCRing.TurnAllON(); } else { CCRing.TurnAllOFF(); } }
public void ReadyToUpdate(CCRing ccr) { //print ("ReadyToUpdate!" + ccr); MiroModelV1 miro = CellObjCtrlUtils.GetMiroModelFromCell(ccr._cellCtrl); _miros.Add(miro); _ctrls[ccr._cellCtrl] = false; if (_miros.Count == _mgr._MiroObjs.Count) { PlaceRing(); } }
public bool InRing(Hex coord) { List <List <Hex> > rings = CCRing.GetRings(); foreach (var lstR in rings) { foreach (Hex h in lstR) { if (h.q == coord.q && h.r == coord.r && h.s == coord.s) { return(true); } } } return(false); }
// ------------------- 棋子阵型 ----------------------- // 下列接口主要返回视觉上显示出来的各种特殊阵型 public List <List <Hex> > GetRings(int campId) { List <List <Hex> > rings = CCRing.GetRings(); return(rings); }
/* * override protected void _Calculate() * { * List<CellObjCtrl> ringObjs = new List<CellObjCtrl>(); * bool bDetected = * CellObjCtrlUtils.DetectNPCCloseChainFrom (_cellCtrl, ref ringObjs); * * bool bRing = (ringObjs.Count > 2)&&bDetected; * * if (bRing) { * //Debug.Log ("SetUpRing"); * SetupRing (ringObjs); * } else { * //Debug.Log ("UnSetUpRing"); * UnSetupRing (ringObjs); * } * * bool bInRing = ringObjs.Contains (_cellCtrl); * if (!bInRing) { * MiroModelV1 model = CellObjCtrlUtils.GetMiroModelFromCell (_cellCtrl); * model.ShrinkRing (); * } * * } */ void SetupRing(List <CellObjCtrl> ringObjs) { bool bExist = false; foreach (List <CellObjCtrl> ringObjLst in _Rings) { bool bSame = IsContainSame(ringObjs, ringObjLst); if (bSame) { bExist = true; IsContainSame(ringObjs, ringObjLst); //Debug.Log ("bSame!"); return; } } bool bIdAdded = true; foreach (CellObjCtrl ctrl in ringObjs) { CCRing cc = ctrl.GetComponentInChildren <CCRing> (); bIdAdded = bIdAdded && cc.IsIdAdded(); } if (!bExist && !bIdAdded) { ReorderRing(ref ringObjs); AddIdInRing(ringObjs); // shrink smaller ring for (int i = _Rings.Count - 1; i >= 0; i--) { List <CellObjCtrl> lstCtrl = _Rings [i]; foreach (var ctrl in lstCtrl) { if (ringObjs.Contains(ctrl)) { MiroModelV1 model = ctrl._TgtObj.GetComponent <MiroModelV1> (); model.ShrinkRing(); Debug.Log("model.ShrinkRing (): " + model.name); break; } } } foreach (List <CellObjCtrl> lstCtrl in _Rings) { for (int i = lstCtrl.Count - 1; i >= 0; i--) { } foreach (var ctrl in lstCtrl) { if (ringObjs.Contains(ctrl)) { MiroModelV1 model = ctrl._TgtObj.GetComponent <MiroModelV1> (); model.ShrinkRing(); Debug.Log("model.ShrinkRing (): " + model.name); } } } // create new ring List <GameObject> rObjs = new List <GameObject> (); foreach (CellObjCtrl ctrl in ringObjs) { rObjs.Add(ctrl._TgtObj); } _mgr.CreateRing(rObjs); Debug.Log("_mgr.CreateRing (rObjs);"); _Rings.Add(ringObjs); } if (_IdInRing == ringObjs.Count - 1) { ResetIdInRing(ringObjs); } }