Beispiel #1
0
        public DataTable GetDataTableWithSql(string tblname, string sql)
        {
            TableUnit unit  = null;
            DataTable table = null;

            AcquireReadTableLock(tblname);
            try
            {
                SaveTableNoLock(tblname);

                unit = mTableUnitManager.GetTableUnitWithSql(sql);

                table = unit.GetTable();

                string message = string.Format("GetDataTable {0}: {1} rows", sql, table.Rows.Count);
                mLogHelper.LogMessage(mClientKey, message, LogType.GetTableSql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ReleaseReadTableLock(tblname);
            }

            return(table);
        }
Beispiel #2
0
        public DataTable GetDataTableTopRow(string tblname)
        {
            DataTable table = null;
            DataTable tbl   = null;

            AcquireReadTableLock(tblname);
            try
            {
                TableUnit unit = mTableUnitManager.GetTableUnit(tblname);

                table = unit.GetTable();
                tbl   = table.Clone();

                if (table.Rows.Count > 0)
                {
                    DataRow row = table.Rows[0];
                    tbl.ImportRow(row);
                }

                string message = string.Format("GetDataTableTop1 {0}", tblname);
                mLogHelper.LogMessage(mClientKey, message, LogType.GetTable);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ReleaseReadTableLock(tblname);
            }

            return(tbl);
        }
Beispiel #3
0
    private IEnumerator SpawnUnit(int _UnitIndex, Transform _SpawnTransform, TeamType _Team)
    {
        Debug.Log("<color=red>StageManager</color> SpawnUnit : " + _UnitIndex);

        //유닛 테이블 데이터를 가져옴
        TableUnit unitdata = UnityDataConnector.Instance.m_TableData_Unit.GetUnitData(_UnitIndex);

        if (unitdata == null)
        {
            yield break;
        }

        GameObject prefab;

        //풀버전 빌드시에는 Resources.Load로 리소스를 로드합니다.
        if (AssetLoadScript.Instance.IsFullVersionBuild)
        {
            #region 리소스폴더 로드

            prefab = (GameObject)AssetLoadScript.Instance.Get(eAssetType.Unit, unitdata.ResourceName);

            #endregion 리소스폴더 로드
        }
        else
        {
            #region 어셋번들 로드

            //번들이름과 리소스이름으로 번들 데이터를 로드
            string BundleName = eAssetType.Unit.ToString().ToLower();
            AssetBundleLoadAssetOperation request = AssetBundleManager.LoadAssetAsync(BundleName, unitdata.ResourceName, typeof(GameObject));
            if (request == null)
            {
                yield break;
            }
            yield return(StartCoroutine(request));

            // Get the asset.
            prefab = request.GetAsset <GameObject>();

            #endregion 어셋번들 로드
        }

        if (prefab != null)
        {
            GameObject     tw  = GameUtil.CreateObjectToRoot(prefab, _SpawnTransform.position, _SpawnTransform.rotation.eulerAngles, Vector3.one);
            UnitController con = tw.GetComponent <UnitController>();
            con.SetTeam(_Team, CreateHpBar());
            con.SetData(unitdata);
            con.tr_SpawnedTransform = _SpawnTransform;
            tw.name = string.Format("{0}_{1}", con.BaseAbility.UnitName, _Team);

            AddLiveData(con);
        }
    }
Beispiel #4
0
    public string GetResourceName(int _Index)
    {
        string    resname = string.Empty;
        TableUnit _data   = GetUnitData(_Index);

        if (_data != null)
        {
            resname = _data.ResourceName;
        }

        return(resname);
    }
Beispiel #5
0
    public void SetData(BattleUnitData _Data)
    {
        UnitData = _Data;
        TableUnit UnitBaseData = UnityDataConnector.Instance.m_TableData_Unit.GetUnitData(_Data.UnitID);
        Object    res          = AssetLoadScript.Instance.Get(eAssetType.Texture, string.Format("Unit_{0}", _Data.UnitID));

        if (res != null)
        {
            //string _IconTexturePath = string.Format("/Texture/UnitCard/Unit_{0}", _data.UnitID);
            tx_unitIcon.mainTexture = (Texture2D)res;
        }

        //lb_cost.text = UnitBaseData.Cost.ToString();
        lb_cost.text = UnitBaseData.Index.ToString();
    }
Beispiel #6
0
        public DataTable GetDataTable(string tblname, string filter, string order)
        {
            DataRow[] rows  = null;
            DataTable tbl   = null;
            DataTable table = null;

            AcquireReadTableLock(tblname);
            try
            {
                TableUnit unit = mTableUnitManager.GetTableUnit(tblname);
                table = unit.GetTable();
                rows  = table.Select(filter, order);
                tbl   = table.Clone();

                if (rows != null)
                {
                    foreach (DataRow row in rows)
                    {
                        tbl.ImportRow(row);
                    }
                }

                string message = string.Format("GetDataTable {0}: ", tblname);

                if (filter != null && filter != string.Empty)
                {
                    message += string.Format("where {0};", filter);
                }

                if (order != null && order != string.Empty)
                {
                    message += string.Format("order by {0};", order);
                }

                message += string.Format(" {0} rows", tbl.Rows.Count);
                mLogHelper.LogMessage(mClientKey, message, LogType.GetTable);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ReleaseReadTableLock(tblname);
            }

            return(tbl);
        }
Beispiel #7
0
        public int GetTableRowCount(string tblname, string dbname)
        {
            int nRet            = 0;
            TableUnitManager tm = TableHelper.GetTableUnitManangerByDbname(dbname);

            if (tm != null)
            {
                bool bRet = tm.ExistTable(tblname);
                if (bRet)
                {
                    TableUnit unit  = tm.GetTableUnit(tblname);
                    DataTable table = unit.GetTable();
                    nRet = table.Rows.Count;
                }
            }
            return(nRet);
        }
Beispiel #8
0
    /// <summary>슬롯에 유닛 정보 세팅</summary>
    public void SetData(BattleUnitData _data, eUnitSlotType _sType)
    {
        _slotType        = _sType;
        IsEquipedDeck    = false;
        _Unitdata        = _data;
        lb_position.text = (_Unitdata.Index == -1) ? string.Empty : ((eBattlePosition)_Unitdata.Index).ToString();
        UnitBaseData     = UnityDataConnector.Instance.m_TableData_Unit.GetUnitData(_data.UnitID);
        Object res = AssetLoadScript.Instance.Get(eAssetType.Texture, string.Format("Unit_{0}", _data.UnitID));

        if (res != null)
        {
            //string _IconTexturePath = string.Format("/Texture/UnitCard/Unit_{0}", _data.UnitID);
            tx_UnitIcon.mainTexture = (Texture2D)res;
        }

        lb_Unitname.text  = UnitBaseData.UnitName;
        lb_HaveCount.text = _Unitdata.CardCount.ToString();
        lb_Cost.text      = UnitBaseData.Cost.ToString();
        RefreshControllButton();
    }
        private async Task <List <TableUnit> > GetUpdatedPlaylogDetailRecordUnitsAsync(IPlaylogRecordTable <IPlaylogRecordTableUnit> playlogRecord, TableUnit lastPlaylogDetailRecordUnit)
        {
            var updatedPlaylogDetailRecordUnits = new List <TableUnit>();
            var lastPlayDate   = lastPlaylogDetailRecordUnit?.PlaylogDetail?.PlayDate ?? new DateTime();
            var startNumber    = lastPlaylogDetailRecordUnit?.Number + 1 ?? 1;
            var startPlayCount = lastPlaylogDetailRecordUnit?.PlayCount + 1 ?? 1;

            var tableUnits = playlogRecord.GetTableUnits().ToList();

            for (var i = 0; i < tableUnits.Count; i++)
            {
                if (tableUnits[i].PlayDate <= lastPlayDate)
                {
                    continue;
                }

                var index = tableUnits.Count - (i + 1);
                DebugLogger.WriteLine("PlaylogDetailの取得 Index : {0}", index);
                var   sendAsync = chunithmNetConnector.GetPlaylogDetailAsync(index);
                await sendAsync;

                var playlogDetail = sendAsync.Result;
                if (!playlogDetail.Success)
                {
                    throw new Exception($"PlaylogDetail[{index}]の取得に失敗しました");
                }

                var recordUnit = new TableUnit();
                recordUnit.Number        = startNumber + updatedPlaylogDetailRecordUnits.Count;
                recordUnit.PlayCount     = startPlayCount + updatedPlaylogDetailRecordUnits.Count;
                recordUnit.PlaylogDetail = playlogDetail.PlaylogDetail;
                updatedPlaylogDetailRecordUnits.Add(recordUnit);
            }

            return(updatedPlaylogDetailRecordUnits);
        }
    /// <summary>유닛 능력치 데이터 세팅</summary>
    public void SetData(TableUnit unitdata)
    {
        NMA      = GetComponent <NavMeshAgent>();
        animator = GetComponent <Animator>();

        BaseAbility.Index      = unitdata.Index;
        BaseAbility.UnitName   = unitdata.UnitName;
        BaseAbility.type       = unitdata.type;
        BaseAbility.Level      = 1;
        BaseAbility.HP_Current = unitdata.HP_Max;
        BaseAbility.HP_Max     = unitdata.HP_Max;
        BaseAbility.P_Atk      = unitdata.P_Atk;
        BaseAbility.P_Def      = unitdata.P_Def;
        BaseAbility.M_Atk      = unitdata.M_Atk;
        BaseAbility.M_Def      = unitdata.M_Def;
        BaseAbility.MoveSpeed  = unitdata.MoveSpeed;
        SetNavMeshAgent_Speed(BaseAbility.MoveSpeed);
        BaseAbility.AttackSpeed = unitdata.AttackSpeed;

        BaseAbility.SpawnTime   = unitdata.SpawnTime;
        BaseAbility.AttackRange = unitdata.AtttackRange;
        SetAttackRange(BaseAbility.AttackRange);
        BaseAbility.AttackDelay = unitdata.AttackDelay;
        SetAttackDelay(BaseAbility.AttackDelay);
        BaseAbility.AttackTarget   = unitdata.AttackTarget;
        BaseAbility.IsAttackGround = unitdata.IsAttackGround;
        BaseAbility.IsAttackSky    = unitdata.IsAttackSky;
        BaseAbility.IsAttackTower  = unitdata.IsAttackTower;
        CustumizeUnit(unitdata);

        hpBar.SetValueMax(TotalMaxHP);
        hpBar_followObject.offset = new Vector2(unitdata.HPBarOffSetX, unitdata.HPBarOffSetY);
        UpdateHpBar();

        base.SetProjectileData(unitdata.ProjectileIndex);
    }
Beispiel #11
0
        /// <summary>
        /// 生成表格的Html代码
        /// </summary>
        /// <param name="row">行</param>
        /// <param name="col">列</param>
        /// <param name="width">宽</param>
        /// <param name="unit">表格宽度的单位</param>
        /// <param name="borderWidth">边宽</param>
        /// <param name="cellSpac">边距</param>
        /// <param name="cellPadd">间距</param>
        /// <param name="scope">表格头显示方式</param>
        /// <param name="caption">标题</param>
        /// <param name="align">标题的显示方式</param>
        /// <param name="summary">摘要</param>
        /// <returns></returns>
        public string TableHtml(
            string rows,
            string cols,
            string width,
            TableUnit unit,
            string borderWidth,
            string cellSpac,
            string cellPadd,
            HeadScope scope,
            string caption,
            string align,
            string summary

            )
        {
            string tableCode = "";

            XmlDocument doc = new XmlDocument();
            XmlElement  ele = doc.CreateElement("table");

            if (width != "")
            {
                switch (unit)
                {
                case TableUnit.percent:
                    ele.SetAttribute("width", width + "%");
                    break;

                case TableUnit.pix:
                    ele.SetAttribute("width", width);
                    break;

                default:
                    break;
                }
            }
            if (borderWidth != "" && borderWidth != "0")
            {
                ele.SetAttribute("border", borderWidth);
            }
            else if (borderWidth == "0")
            {
                ele.SetAttribute("Style", "border:Dashed 3px");// System.Web.UI.WebControls.BorderStyle.Dotted.ToString());
                ele.SetAttribute("border", "1");
            }
            if (cellSpac != "")
            {
                ele.SetAttribute("cellsapcing", cellSpac);
            }
            if (cellPadd != "")
            {
                ele.SetAttribute("cellpadding", cellPadd);
            }
            if (summary != "")
            {
                ele.SetAttribute("summary", summary);
            }
            if (caption != "")
            {
                XmlElement eleCap = doc.CreateElement("caption");
                eleCap.SetAttribute("align", align);
                eleCap.InnerText = caption;
                ele.AppendChild(eleCap);
            }
            for (int r = 0; r < Convert.ToInt32(rows); r++)
            {
                XmlElement eleTR = doc.CreateElement("tr");
                for (int c = 0; c < Convert.ToInt32(cols); c++)
                {
                    XmlElement eleTD = doc.CreateElement("td");
                    switch (scope)
                    {
                    case HeadScope.none:
                        break;

                    case HeadScope.left:
                        if (c == 0)
                        {
                            eleTD.SetAttribute("scope", "row");
                        }
                        break;

                    case HeadScope.top:
                        if (r == 0)
                        {
                            eleTD.SetAttribute("scope", "col");
                        }
                        break;

                    case HeadScope.both:
                        if (r == 0)
                        {
                            eleTD.SetAttribute("scope", "col");
                        }
                        else
                        {
                            if (c == 0)
                            {
                                eleTD.SetAttribute("scope", "row");
                            }
                        }
                        break;

                    default:
                        break;
                    }
                    //eleTD.InnerXml = "&nbsp;";
                    eleTR.AppendChild(eleTD);
                }
                ele.AppendChild(eleTR);
            }
            XmlNode tableNode = doc.AppendChild(ele);

            tableCode = tableNode.OuterXml;
            return(tableCode);
        }
 /// <summary>모델링 커스터마이즈</summary>
 public void CustumizeUnit(TableUnit unitdata)
 {
     //테이블 데이터에 있는 크기에 맞게 조절
     transform.localScale = new Vector3(unitdata.UnitScale, unitdata.UnitScale, unitdata.UnitScale);
 }
Beispiel #13
0
    private void CheckAbleSpawnUnit(TeamType _team, Vector3 _SpawnPos)
    {
        TableUnit unitdata = UnityDataConnector.Instance.m_TableData_Unit.GetUnitData(1);

        TeamManagerScript.Instance.CheckAbleSpawn(_team, 1);
    }