// Create Cmd list type public void CreateCMDList( _CMD_TYPE nType ) { // clear all child List<_CMD_ID> typeList = new List<_CMD_ID>(); typeList.Add( _CMD_ID._CANCEL ); // switch( nType ) { case _CMD_TYPE._SYS: break; case _CMD_TYPE._CELL: break; } // foreach( _CMD_ID cmdid in typeList ) { int nArg1 = 0; int nArg2 = 0; int nArg3 = 0; CreateCMDButton(cmdid , nArg1 , nArg2 ,nArg3 ); } }
public List<_CMD_ID> GetCmdList( _CMD_TYPE eType) { int itype = (int)eType; if (itype < 0 || itype >= CmdlistArray.Length) { return null; } return CmdlistArray [itype]; }
public _CMD_TARGET eCMDAOETARGET; // record Aoe target type public void Clear() { nCmderIdent = 0; eCMDTYPE = _CMD_TYPE._SYS; eCMDSTATUS = _CMD_STATUS._NONE; eCMDTARGET = _CMD_TARGET._ALL; eCMDID = _CMD_ID._NONE; // eLastCMDID = _CMD_ID._NONE; eLASTCMDTYPE = _CMD_TYPE._SYS;; // LAST Cmd type eNEXTCMDTYPE = _CMD_TYPE._SYS; nTarIdent = 0; nOrgGridX = 0; nOrgGridY = 0; nTarGridX = 0; nTarGridY = 0; nSkillID = 0; nAbilityID = 0; nItemID = 0; nAOEID = 0; eCMDAOETARGET = _CMD_TARGET._ALL; }
public static Panel_CMDUnitUI OpenCMDUI( _CMD_TYPE type , Panel_unit cmder ) { cCMD.Instance.eCMDTYPE = type; Panel_CMDUnitUI panel = MyTool.GetPanel<Panel_CMDUnitUI> ( PanelManager.Instance.OpenUI (Panel_CMDUnitUI.Name) ); if( panel == null ) { return panel; } // if cmder is change if (cmder != null) { panel.SetCmder (cmder); } cCMD.Instance.eCMDSTATUS = _CMD_STATUS._WAIT_CMDID; panel.CreateCMDList (type); //if (PanelManager.Instance.CheckUIIsOpening (Panel_CMDUnitUI.Name)) { //} return panel; }
// cmd STATIC FUNC public static Panel_CMDUnitUI OpenCMDUI( _CMD_TYPE type , int nIdent ) { return OpenCMDUI (type, Panel_StageUI.Instance.GetUnitByIdent (nIdent)); }
void CreateCMDList( _CMD_TYPE eType ) { ClearCmdPool (); // always clear first List< _CMD_ID > cmdList = cCMD.Instance.GetCmdList ( eType ); if (cmdList == null) return; if (NGuiGrids == null) return; // record cmd type CMD.eLASTCMDTYPE = CMD.eCMDTYPE; CMD.eCMDTYPE = eType; foreach( _CMD_ID id in cmdList ) { //GameObject obj = ResourcesManager.CreatePrefabGameObj( this.NGuiGrids , "Prefab/CMD_BTN" ); // create cmd and add to grid GameObject obj = CmdButton.Spawn( NGuiGrids.transform ); if( obj != null ) { obj.name = MyTool.GetCMDNameByID( id ); UILabel lbl = obj.GetComponentInChildren<UILabel> (); if( lbl != null ) { lbl.text = obj.name ; // Load Label by const data } UIEventListener.Get(obj).onClick += OnCMDButtonClick; } } // update UIGrid grid = NGuiGrids.GetComponent<UIGrid>(); grid.repositionNow = true; // need this for second pop to re pos if( _CMD_TYPE._WAITATK == CMD.eCMDTYPE ) { // auto show atk cell Panel_StageUI.Instance.ClearOverCellEffect (); Panel_StageUI.Instance.CreateAttackOverEffect (pCmder); } }