Ejemplo n.º 1
0
 /// <summary>
 ///  根据Key值改变角色的类型为int的属性
 /// </summary>
 /// <param name="type"></param>
 /// <param name="nValue"></param>
 /// <param name="operate"></param>
 /// <param name="sync_db"></param>
 /// <param name="sync_client"></param>
 /// <param name="sync_ws"></param>
 /// <param name="sync_gl"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public virtual bool ChangeAttribInteger(eUnitModType type, long nValue, eUnitAttrOperate operate, bool sync_db = true, bool sync_client = true, bool sync_ws = true, bool sync_gl = true, bool sync_fs = true, eUnitAttrAction action = eUnitAttrAction.Unknow)
 {
     return(false);
 }
Ejemplo n.º 2
0
        public override bool ChangeAttribInteger(eUnitModType type, long nValue, eUnitAttrOperate operate, bool sync_db = true, bool sync_client = true, bool sync_ws = true, bool sync_gl = true, bool sync_fs = true, eUnitAttrAction action = eUnitAttrAction.Unknow)
        {
            if (nValue == 0)
            {
                return(false);
            }
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return(false);
            }

            long base_value = this.GetAttribInteger(type);
            long dst_value  = base_value;

            switch (operate)
            {
            case eUnitAttrOperate.Add:
                dst_value += nValue;
                break;

            case eUnitAttrOperate.Sub:
                dst_value -= nValue;
                break;

            case eUnitAttrOperate.Mul:
                dst_value *= nValue;
                break;

            case eUnitAttrOperate.Div:
                dst_value /= nValue;
                break;
            }
            if (dst_value == base_value)
            {
                return(false);
            }
            if (sync_client && IsNeedSyncClient(type))
            {
                Send2Client(type, dst_value, action);
            }
            if (sync_db)
            {
                Send2DB(type, nValue);
            }
            if (sync_ws && IsNeedSyncWS(type))
            {
                Send2WS(type, nValue);
            }
            if (sync_gl && IsNeedSyncGL(type))
            {
                Send2GL(type, nValue);
            }
            if (sync_fs && IsNeedSyncFS(type))
            {
                Send2FS(type, nValue);
            }

            return(true);
        }