提交前端腳本
This commit is contained in:
parent
a686d8fc9c
commit
7208029207
BIN
Assets/Resources/Script/.DS_Store
vendored
Normal file
BIN
Assets/Resources/Script/.DS_Store
vendored
Normal file
Binary file not shown.
50
Assets/Resources/Script/.emmyrc.json
Normal file
50
Assets/Resources/Script/.emmyrc.json
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"completion": {
|
||||
"autoRequire": true,
|
||||
"autoRequireFunction": "require",
|
||||
"autoRequireNamingConvention": "camelCase",
|
||||
"callSnippet": false,
|
||||
"postfix": "@"
|
||||
},
|
||||
"signature": {
|
||||
"detailSignatureHelper": false
|
||||
},
|
||||
"diagnostics": {
|
||||
"disable": [],
|
||||
"globals": [],
|
||||
"globalsRegex": [],
|
||||
"severity": {},
|
||||
"enables": []
|
||||
},
|
||||
"hint": {
|
||||
"paramHint": true,
|
||||
"indexHint": true,
|
||||
"localHint": true,
|
||||
"overrideHint": true
|
||||
},
|
||||
"runtime": {
|
||||
"version": "Lua5.4",
|
||||
"requireLikeFunction": [],
|
||||
"frameworkVersions": [],
|
||||
"extensions": [],
|
||||
"requirePattern": []
|
||||
},
|
||||
"workspace": {
|
||||
"ignoreDir": [],
|
||||
"ignoreGlobs": [],
|
||||
"library": [],
|
||||
"workspaceRoots": [],
|
||||
"preloadFileSize": 1048576,
|
||||
"encoding": ""
|
||||
},
|
||||
"resource": {
|
||||
"paths": []
|
||||
},
|
||||
"codeLens": {
|
||||
"enable": true
|
||||
},
|
||||
"strict": {
|
||||
"requirePath": false,
|
||||
"typeCall": true
|
||||
}
|
||||
}
|
16
Assets/Resources/Script/.vscode/launch.json
vendored
Normal file
16
Assets/Resources/Script/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "emmylua_attach",
|
||||
"request": "attach",
|
||||
"name": "Attach by process id",
|
||||
"pid": 119488,
|
||||
"processName": "",
|
||||
"captureLog": false
|
||||
}
|
||||
]
|
||||
}
|
10
Assets/Resources/Script/Com.meta
Normal file
10
Assets/Resources/Script/Com.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b118349f591a48839733891e56c2d1f
|
||||
folderAsset: yes
|
||||
timeCreated: 1429499751
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/AssetManager.meta
Normal file
10
Assets/Resources/Script/Com/AssetManager.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 390736b54437845af9102b0b6d82e353
|
||||
folderAsset: yes
|
||||
timeCreated: 1466772134
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
255
Assets/Resources/Script/Com/AssetManager/AssetManager.txt
Normal file
255
Assets/Resources/Script/Com/AssetManager/AssetManager.txt
Normal file
@ -0,0 +1,255 @@
|
||||
AssetManager = class('AssetManager')
|
||||
|
||||
AssetManager.CachePoolNum = 10
|
||||
|
||||
function AssetManager.Me()
|
||||
if nil == AssetManager.me then
|
||||
AssetManager.me = AssetManager.new()
|
||||
end
|
||||
return AssetManager.me
|
||||
end
|
||||
|
||||
function AssetManager.AssetCreator(resID)
|
||||
if(ResourceManager.Instance)then
|
||||
return ResourceManager.Instance:Load(resID);
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function AssetManager.AssetDeletor(assetInfo)
|
||||
AssetManager.AssetRealDeletor(assetInfo.resID)
|
||||
end
|
||||
|
||||
function AssetManager.AssetRealDeletor(resID)
|
||||
if(ResourceManager.Instance)then
|
||||
-- print("AssetRealDeletor "..resID.getRealPath)
|
||||
ResourceManager.Instance:UnLoad(resID, false);
|
||||
end
|
||||
end
|
||||
|
||||
function AssetManager:ctor()
|
||||
self.pool = LuaObjPool.new("AssetPool", 10, AssetManager.AssetDeletor)
|
||||
self:Reset()
|
||||
end
|
||||
|
||||
function AssetManager:Reset()
|
||||
self.assetInfoCache = {}
|
||||
self.ownerMapAssetInfo = {}
|
||||
self.cachePool = {}
|
||||
end
|
||||
|
||||
function AssetManager:RealLoadAsset(resID)
|
||||
local resInfo = self.pool:Get(resID.getRealPath)
|
||||
if nil ~= resInfo then
|
||||
-- print("RealLoadAsset "..resID.getRealPath)
|
||||
return resInfo.asset
|
||||
end
|
||||
local asset = AssetManager.AssetCreator(resID)
|
||||
if nil == asset then
|
||||
return nil
|
||||
end
|
||||
return asset
|
||||
end
|
||||
|
||||
function AssetManager:RealUnloadAsset(resID, asset)
|
||||
if(asset~=nil and not GameObjectUtil.Instance:ObjectIsNULL(asset)) then
|
||||
local resInfo = {}
|
||||
resInfo.asset = asset
|
||||
resInfo.resID = resID
|
||||
-- print("RealUnloadAsset "..resID.getRealPath)
|
||||
self.pool:Put(resID.getRealPath, resInfo)
|
||||
end
|
||||
end
|
||||
|
||||
function AssetManager:AddAssetInfo(resID,asset,owner)
|
||||
local assetInfo = self:GetAssetInfo(resID)
|
||||
if(assetInfo == nil) then
|
||||
assetInfo = AssetInfo.new(asset,owner,resID)
|
||||
self.assetInfoCache[resID.getRealPath] = assetInfo
|
||||
else
|
||||
assetInfo:AddOwner(owner)
|
||||
end
|
||||
return assetInfo
|
||||
end
|
||||
|
||||
-- unique begin
|
||||
function AssetManager:GetOnwerAssetInfo(owner)
|
||||
return self.ownerMapAssetInfo[owner]
|
||||
end
|
||||
|
||||
function AssetManager:SetOnwerAssetInfo(owner, assetInfo)
|
||||
self.ownerMapAssetInfo[owner] = assetInfo
|
||||
end
|
||||
|
||||
function AssetManager:TryClearUnusedOwnerAssetInfo()
|
||||
local goUtil = GameObjectUtil.Instance
|
||||
local removes = {}
|
||||
for k,v in pairs(self.ownerMapAssetInfo) do
|
||||
if goUtil:ObjectIsNULL(k) then
|
||||
removes[#removes + 1] = k
|
||||
end
|
||||
end
|
||||
if(removes and 0 < #removes) then
|
||||
for i=1,#removes do
|
||||
self:SetOnwerAssetInfo(removes[i], nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AssetManager:TryClearOwnerOldAssetInfo(owner, resID)
|
||||
local cleared = false
|
||||
local ownerMapInfo = self:GetOnwerAssetInfo(owner)
|
||||
if nil ~= ownerMapInfo then
|
||||
if nil == resID or not ownerMapInfo:IsResID(resID) then
|
||||
self:SetOnwerAssetInfo(owner, nil)
|
||||
cleared = true
|
||||
end
|
||||
end
|
||||
return ownerMapInfo, cleared
|
||||
end
|
||||
|
||||
-- unique end
|
||||
|
||||
function AssetManager:GetAssetInfo(resID)
|
||||
return self.assetInfoCache[resID.getRealPath]
|
||||
end
|
||||
|
||||
function AssetManager:DisposeAssetInfo(resID)
|
||||
local assetInfo = self:GetAssetInfo(resID)
|
||||
if(assetInfo) then
|
||||
self.assetInfoCache[resID.getRealPath] = nil
|
||||
self:RealUnloadAsset(resID, assetInfo.asset)
|
||||
end
|
||||
end
|
||||
|
||||
function AssetManager:LoadAsset(owner,resID)
|
||||
-- unique test begin
|
||||
local oldAssetInfo, cleared = self:TryClearOwnerOldAssetInfo(owner, resID)
|
||||
if nil ~= oldAssetInfo then
|
||||
if cleared then
|
||||
self:UnLoadAsset(owner, oldAssetInfo.resID)
|
||||
else
|
||||
return oldAssetInfo.asset
|
||||
end
|
||||
end
|
||||
-- unique test end
|
||||
|
||||
local assetInfo = self:GetAssetInfo(resID)
|
||||
if(assetInfo==nil) then
|
||||
-- print("create new info.."..resID.getRealPath)
|
||||
local asset = self:RealLoadAsset(resID)
|
||||
if nil == asset then
|
||||
-- print("asset is nil!!!!")
|
||||
return nil
|
||||
end
|
||||
assetInfo = self:AddAssetInfo(resID,asset,owner)
|
||||
else
|
||||
assetInfo:AddOwner(owner)
|
||||
end
|
||||
|
||||
self:SetOnwerAssetInfo(owner, assetInfo)
|
||||
-- print(resID.getRealPath,assetInfo.asset)
|
||||
return assetInfo.asset
|
||||
end
|
||||
|
||||
function AssetManager:UnLoadAsset(owner,resID)
|
||||
-- unique test begin
|
||||
self:TryClearOwnerOldAssetInfo(owner, nil)
|
||||
-- unique test end
|
||||
|
||||
local assetInfo = self:GetAssetInfo(resID)
|
||||
if(assetInfo) then
|
||||
assetInfo:RemoveOwner(owner)
|
||||
assetInfo:RemoveUnUsedOwners()
|
||||
if(assetInfo:HasNoOwners()) then
|
||||
self:DisposeAssetInfo(resID,true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AssetManager:TryUnLoadAllUnused()
|
||||
local removes
|
||||
for k,v in pairs(self.assetInfoCache) do
|
||||
v:RemoveUnUsedOwners()
|
||||
if(v:HasNoOwners()) then
|
||||
removes = removes or {}
|
||||
removes[#removes + 1] = k
|
||||
-- print("TryUnLoadAllUnused "..k)
|
||||
self:RealUnloadAsset(v.resID,v.asset)
|
||||
end
|
||||
end
|
||||
if(removes) then
|
||||
for i=1,#removes do
|
||||
self.assetInfoCache[removes[i]] = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- for k,v in pairs(self.assetInfoCache) do
|
||||
-- print("left.."..k)
|
||||
-- end
|
||||
|
||||
-- unique test begin
|
||||
self:TryClearUnusedOwnerAssetInfo()
|
||||
-- unique test end
|
||||
end
|
||||
|
||||
function AssetManager:TryUnLoadUnused(resID)
|
||||
local assetInfo = self:GetAssetInfo(resID)
|
||||
if(assetInfo) then
|
||||
assetInfo:RemoveUnUsedOwners()
|
||||
if(assetInfo:HasNoOwners()) then
|
||||
self:DisposeAssetInfo(resID)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
AssetInfo = class("AssetInfo")
|
||||
|
||||
function AssetInfo:ctor(asset,owner,resID)
|
||||
self.asset = asset
|
||||
self.resID = resID
|
||||
self.owners = {}
|
||||
self:AddOwner(owner)
|
||||
end
|
||||
|
||||
function AssetInfo:AddOwner(owner)
|
||||
if(owner) then
|
||||
local findIndex = TableUtil.ArrayIndexOf(self.owners,owner)
|
||||
if(findIndex == 0) then
|
||||
self.owners[#self.owners + 1] = owner
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function AssetInfo:RemoveOwner(owner)
|
||||
local index = TableUtil.Remove(self.owners,owner)
|
||||
return index~= 0
|
||||
end
|
||||
|
||||
function AssetInfo:RemoveUnUsedOwners()
|
||||
local goUtil = GameObjectUtil.Instance
|
||||
local o
|
||||
for i=#self.owners,1,-1 do
|
||||
o = self.owners[i]
|
||||
if(o==nil or goUtil:ObjectIsNULL(o)) then
|
||||
table.remove(self.owners,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AssetInfo:HasNoOwners()
|
||||
return #self.owners == 0
|
||||
end
|
||||
|
||||
function AssetInfo:IsResID(testResID)
|
||||
local eq = false
|
||||
if(testResID and self.resID)then
|
||||
eq = testResID.IDStr == self.resID.IDStr
|
||||
end
|
||||
return eq
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6df4ca38148464da59f9f4f7c7eb67d1
|
||||
timeCreated: 1466772230
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,40 @@
|
||||
AssetManager_StageManager = class("AssetManager_StageManager", AssetManager_Role)
|
||||
|
||||
function AssetManager_StageManager:ctor(assetManager)
|
||||
AssetManager_StageManager.super.ctor(self, assetManager)
|
||||
local ResPathHelperFuncs = self.ResPathHelperFuncs
|
||||
for k,v in pairs(ResPathHelperFuncs) do
|
||||
if k ~= Asset_Role.PartIndex.Body then
|
||||
ResPathHelperFuncs[k] = ResourcePathHelper.StagePart
|
||||
end
|
||||
end
|
||||
|
||||
self.Table_Equip = Table_StageParts
|
||||
end
|
||||
|
||||
function AssetManager_StageManager:CreatePart(part, ID, callback, owner, custom)
|
||||
-- get from pool
|
||||
-- local obj = GetFromRolePartPool[part](Game.GOLuaPoolManager, ID)
|
||||
-- if nil ~= obj then
|
||||
-- obj.layer = 0
|
||||
-- callback(owner, nil, obj, part, ID, custom)
|
||||
-- return nil
|
||||
-- end
|
||||
|
||||
local tag = self:NewTag()
|
||||
self:_AddObserver_Part(part, ID, tag, callback, owner, custom)
|
||||
return tag
|
||||
end
|
||||
|
||||
function AssetManager_StageManager:DestroyPart(part, ID, obj)
|
||||
if nil == obj or LuaGameObject.ObjectIsNull(obj.gameObject) then
|
||||
return
|
||||
end
|
||||
-- put into pool
|
||||
-- if AddToRolePartPool[part](Game.GOLuaPoolManager, ID, obj) then
|
||||
-- obj:UseOriginMaterials()
|
||||
-- return
|
||||
-- end
|
||||
|
||||
LuaGameObject.DestroyObject(obj.gameObject)
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fbb11558336f43f19b926cf8847f15c
|
||||
timeCreated: 1531229558
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Audio.meta
Normal file
10
Assets/Resources/Script/Com/Audio.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b570fd84beac4740841510b68737d13
|
||||
folderAsset: yes
|
||||
timeCreated: 1463975797
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
55
Assets/Resources/Script/Com/Audio/AudioController.txt
Normal file
55
Assets/Resources/Script/Com/Audio/AudioController.txt
Normal file
@ -0,0 +1,55 @@
|
||||
AudioController = class('AudioController')
|
||||
|
||||
--interval:毫秒
|
||||
function AudioController:ctor(audioObj,interval,finishCallback)
|
||||
self.source = audioObj:GetComponent(AudioSource)
|
||||
self.interval = interval
|
||||
if self.interval == nil then
|
||||
self.interval = 1000
|
||||
end
|
||||
self.callback = finishCallback
|
||||
end
|
||||
|
||||
function AudioController:SetFinishCallback(finishCallback)
|
||||
self.callback = finishCallback
|
||||
end
|
||||
|
||||
function AudioController:Play(audioClip)
|
||||
|
||||
if self.source.clip ~= nil then
|
||||
GameObject.Destroy(self.source.clip)
|
||||
end
|
||||
|
||||
self.source.clip = audioClip
|
||||
self.source:Play()
|
||||
|
||||
if self.timeTick == nil then
|
||||
self.timeTick = TimeTickManager.Me():CreateTick(0,self.interval,self.IsFinish,self)
|
||||
end
|
||||
end
|
||||
|
||||
function AudioController:Pause()
|
||||
self.source:Pause()
|
||||
end
|
||||
|
||||
function AudioController:Stop()
|
||||
self.source:Stop()
|
||||
|
||||
TimeTickManager.Me():ClearTick(self)
|
||||
self.timeTick = nil
|
||||
end
|
||||
|
||||
function AudioController:IsFinish()
|
||||
if not self.source.isPlaying then
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
if self.source.clip ~= nil then
|
||||
GameObject.Destroy(self.source.clip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AudioController:IsPlaying()
|
||||
return self.source.isPlaying
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bff8d8683d6e94b19921d5f22da7aebf
|
||||
timeCreated: 1463976040
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/BehaviourTree.meta
Normal file
10
Assets/Resources/Script/Com/BehaviourTree.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea7e0e49b929948319f71090a29799b2
|
||||
folderAsset: yes
|
||||
timeCreated: 1439446019
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
66
Assets/Resources/Script/Com/BehaviourTree/LBehaviorTree.txt
Normal file
66
Assets/Resources/Script/Com/BehaviourTree/LBehaviorTree.txt
Normal file
@ -0,0 +1,66 @@
|
||||
autoImport("LRootNode")
|
||||
autoImport("LActionNode")
|
||||
autoImport("LConditionNode")
|
||||
autoImport("LParentNode")
|
||||
autoImport("LParallelNode")
|
||||
autoImport("LSequenceNode")
|
||||
autoImport("LSelectorNode")
|
||||
|
||||
LBehaviorTree = class('LBehaviorTree')
|
||||
|
||||
function LBehaviorTree:ctor(name)
|
||||
self.Name = name
|
||||
self.rootNode = nil
|
||||
self.paused = false
|
||||
self.isRunning = false
|
||||
self.curState = nil
|
||||
self.isComplete = false
|
||||
self.blackBoard = {}
|
||||
end
|
||||
|
||||
function LBehaviorTree:Run()
|
||||
if(not self.isRunning) then
|
||||
self.isRunning = true
|
||||
end
|
||||
end
|
||||
|
||||
function LBehaviorTree:Pause()
|
||||
if (not self.isRunning or paused) then
|
||||
return
|
||||
end
|
||||
paused = true;
|
||||
end
|
||||
|
||||
function LBehaviorTree:Resume()
|
||||
if (not self.isRunning or not paused) then
|
||||
return
|
||||
end
|
||||
paused = false;
|
||||
end
|
||||
|
||||
function LBehaviorTree:GetRootNode(autoGenerate)
|
||||
if(autoGenerate and self.rootNode==nil) then
|
||||
self.rootNode = LRootNode.new(self)
|
||||
end
|
||||
return self.rootNode
|
||||
end
|
||||
|
||||
function LBehaviorTree:ClearRootNode()
|
||||
self.rootNode = nil
|
||||
end
|
||||
|
||||
function LBehaviorTree:OnUpdate()
|
||||
if(not self.isRunning or self.rootNode == nil) then
|
||||
return TaskState.Failure
|
||||
end
|
||||
if(self.paused) then
|
||||
return TaskState.Inactive;
|
||||
end
|
||||
local result = self.rootNode:Update ()
|
||||
return result
|
||||
end
|
||||
|
||||
function LBehaviorTree:Update()
|
||||
self.curState = self:OnUpdate()
|
||||
return self.curState
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60f619b31df0547c694d259550eb5a03
|
||||
timeCreated: 1439450584
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/BehaviourTree/Nodes.meta
Normal file
10
Assets/Resources/Script/Com/BehaviourTree/Nodes.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de6090a29779e4fcf85aa37815b8c1e5
|
||||
folderAsset: yes
|
||||
timeCreated: 1439446101
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
--並行處理節點
|
||||
autoImport("LNode")
|
||||
LActionNode = class('LActionNode',LNode)
|
||||
|
||||
function LActionNode:DoAction()
|
||||
return TaskState.Running
|
||||
end
|
||||
|
||||
function LActionNode:Update()
|
||||
return self:DoAction()
|
||||
-- return TaskState.Success;
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 566611885813f495abe9f360487123f6
|
||||
timeCreated: 1439455722
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,25 @@
|
||||
--條件結點
|
||||
autoImport("LNode")
|
||||
LConditionNode = class('LConditionNode',LNode)
|
||||
|
||||
function LConditionNode:ctor(behaviorTree,checkFunc,owner,args)
|
||||
LConditionNode.super.ctor(self,behaviorTree)
|
||||
self.checkFunc = checkFunc
|
||||
self.owner = owner
|
||||
self.args = args
|
||||
end
|
||||
|
||||
function LConditionNode:Check()
|
||||
if(owner) then
|
||||
return self.checkFunc(owner,self.args)
|
||||
else
|
||||
return self.checkFunc(self.args)
|
||||
end
|
||||
end
|
||||
|
||||
function LConditionNode:Update()
|
||||
if(self.behaviorTree == nil) then
|
||||
return TaskState.Failure
|
||||
end
|
||||
return self:Check() and TaskState.Success or TaskState.Failure
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6220e19c4bccc46d38fa3264e138a082
|
||||
timeCreated: 1439448825
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
94
Assets/Resources/Script/Com/BehaviourTree/Nodes/LNode.txt
Normal file
94
Assets/Resources/Script/Com/BehaviourTree/Nodes/LNode.txt
Normal file
@ -0,0 +1,94 @@
|
||||
LNode = class('LNode')
|
||||
|
||||
TaskState = {
|
||||
Failure = 0,
|
||||
Inactive = 1,
|
||||
Success = 2,
|
||||
Running = 3,
|
||||
}
|
||||
|
||||
function LNode:ctor(behaviorTree)
|
||||
-- self.PriorityChangedEvent = nil
|
||||
self.behaviorTree = behaviorTree
|
||||
self.parentNode = nil
|
||||
self.isStart = false
|
||||
self.isPasued = false
|
||||
self.priority = 0
|
||||
end
|
||||
|
||||
function LNode.StaticUpdate( node )
|
||||
if (node == nil or node.behaviorTree == nil or node.isPasued) then
|
||||
return TaskState.Inactive;
|
||||
end
|
||||
if (not node.isStart) then
|
||||
node:OnStart ()
|
||||
end
|
||||
local state = node:OnUpdate ()
|
||||
if (state == TaskState.Failure or state == TaskState.Success) then
|
||||
node.OnEnd ()
|
||||
end
|
||||
return state
|
||||
end
|
||||
|
||||
function LNode.SetParentNode( node,parent )
|
||||
node.parentNode = parent;
|
||||
end
|
||||
|
||||
function LNode:SetPriority(value)
|
||||
if (self.priority ~= value)then
|
||||
self.priority = value;
|
||||
-- if (self.PriorityChangedEvent ~= nil) then
|
||||
-- self.PriorityChangedEvent (self)
|
||||
-- end
|
||||
end
|
||||
end
|
||||
|
||||
function LNode:SetIsPaused(value)
|
||||
if (self.isPasued ~= value) then
|
||||
self.isPasued = value;
|
||||
if (self.isPasued)then
|
||||
self:OnPasue ();
|
||||
else
|
||||
self:OnResume ();
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LNode:OnStart()
|
||||
self.isStart = true
|
||||
end
|
||||
|
||||
function LNode:OnEnd()
|
||||
end
|
||||
|
||||
function LNode:OnPasue()
|
||||
end
|
||||
|
||||
function LNode:OnResume()
|
||||
end
|
||||
|
||||
function LNode:OnUpdate()
|
||||
if(self.isPasued) then
|
||||
return TaskState.Inactive
|
||||
end
|
||||
return TaskState.Running
|
||||
end
|
||||
|
||||
function LNode:Update()
|
||||
return LNode.StaticUpdate (self);
|
||||
end
|
||||
|
||||
-- public object GetBBData (string name)
|
||||
-- {
|
||||
-- return behaviorTree.Blackboard.GetData (name);
|
||||
-- }
|
||||
|
||||
-- public T GetBBData<T> (string name) // BB ==> BlackBoard
|
||||
-- {
|
||||
-- return behaviorTree.Blackboard.GetData<T> (name);
|
||||
-- }
|
||||
|
||||
-- public void AddBBData (string name, object value)
|
||||
-- {
|
||||
-- behaviorTree.Blackboard.AddData (name, value);
|
||||
-- }
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d76a9e662aee4d0c8de7e6f87549dee
|
||||
timeCreated: 1439446105
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,11 @@
|
||||
--並行處理節點
|
||||
autoImport("LParentNode")
|
||||
LParallelNode = class('LParallelNode',LParentNode)
|
||||
|
||||
function LParallelNode:Update()
|
||||
local state
|
||||
for i=1,#self.childrenNodes do
|
||||
self.childrenNodes [i]:Update()
|
||||
end
|
||||
return TaskState.Running;
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 145e89998e8ee4354bdaa9db37d91e01
|
||||
timeCreated: 1439449974
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,36 @@
|
||||
autoImport("LNode")
|
||||
LParentNode = class('LParentNode',LNode)
|
||||
|
||||
function LParentNode:ctor(behaviorTree)
|
||||
LParentNode.super.ctor(self,behaviorTree)
|
||||
self.childrenNodes = {}
|
||||
end
|
||||
|
||||
function LParentNode:AddNode( node )
|
||||
if(TableUtil.ArrayIndexOf(self.childrenNodes,node)==0) then
|
||||
self.childrenNodes[#self.childrenNodes + 1] = node
|
||||
end
|
||||
LNode.SetParentNode (node, self);
|
||||
end
|
||||
|
||||
function LParentNode:RemoveNode( node )
|
||||
if(TableUtil.ArrayIndexOf(self.childrenNodes,node)>0) then
|
||||
TableUtil.Remove(self.childrenNodes,node)
|
||||
end
|
||||
LNode.SetParentNode (node, nil);
|
||||
end
|
||||
|
||||
function LParentNode:Update()
|
||||
local node
|
||||
local state
|
||||
for i=1,#self.childrenNodes do
|
||||
node = self.childrenNodes [i];
|
||||
state = node:Update()
|
||||
-- if (state == TaskState.Inactive) then
|
||||
-- continue;
|
||||
if (state == TaskState.Success) then
|
||||
return TaskState.Running;
|
||||
end
|
||||
end
|
||||
return TaskState.Failure;
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 517dc80a1211247aeab8f9e2677299aa
|
||||
timeCreated: 1439447212
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,32 @@
|
||||
--行為樹根節點
|
||||
autoImport("LNode")
|
||||
LRootNode = class('LRootNode',LNode)
|
||||
|
||||
function LRootNode:ctor(behaviorTree)
|
||||
LRootNode.super.ctor(self,behaviorTree)
|
||||
self.directeNode = nil
|
||||
end
|
||||
|
||||
function LRootNode:SetDirecteNode(node)
|
||||
if(self.directeNode~=node) then
|
||||
self.directeNode=node
|
||||
LNode.SetParentNode (self.directeNode, self)
|
||||
end
|
||||
end
|
||||
|
||||
function LRootNode:OnUpdate()
|
||||
if (self.directeNode == nil) then
|
||||
return TaskState.Success
|
||||
end
|
||||
return self.directeNode:Update ()
|
||||
end
|
||||
|
||||
function LRootNode:OnStart()
|
||||
self.isStart = true
|
||||
-- print(string.format("BT:%s, 開始",self.behaviorTree.Name))
|
||||
end
|
||||
|
||||
function LRootNode:OnEnd()
|
||||
LRootNode.super.OnEnd(self)
|
||||
-- print(string.format("BT:%s, 結束",self.behaviorTree.Name))
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b44f2c75e644464e85aae06c5125d04
|
||||
timeCreated: 1439450106
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,19 @@
|
||||
--選擇結點,邏輯或.執行到第一個不為failure的
|
||||
autoImport("LParentNode")
|
||||
LSelectorNode = class('LSelectorNode',LParentNode)
|
||||
|
||||
function LSelectorNode:Update()
|
||||
local node
|
||||
local state
|
||||
for i=1,#self.childrenNodes do
|
||||
node = self.childrenNodes [i];
|
||||
state = node:Update()
|
||||
-- if (state == TaskState.Inactive) then
|
||||
-- continue;
|
||||
-- print("selector",state)
|
||||
if (state ~= TaskState.Failure) then
|
||||
return state
|
||||
end
|
||||
end
|
||||
return TaskState.Failure;
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 322cf5e89d9c64de591d785ba5b5fa7f
|
||||
timeCreated: 1439448002
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,61 @@
|
||||
--順序結點,邏輯與(執行到第一個為failure的節點便停止
|
||||
autoImport("LParentNode")
|
||||
LSequenceNode = class('LSequenceNode',LParentNode)
|
||||
|
||||
function LSequenceNode:ctor(behaviorTree)
|
||||
LSequenceNode.super.ctor(self,behaviorTree)
|
||||
self.conditionNodes = {}
|
||||
end
|
||||
|
||||
function LSequenceNode:AddCondNode(node)
|
||||
if(TableUtil.ArrayIndexOf(self.conditionNodes,node)==0) then
|
||||
self.conditionNodes[#self.conditionNodes + 1] = node
|
||||
end
|
||||
LNode.SetParentNode (node, self);
|
||||
end
|
||||
|
||||
function LSequenceNode:RemoveCondNode( node )
|
||||
if(TableUtil.ArrayIndexOf(self.conditionNodes,node)>0) then
|
||||
TableUtil.Remove(self.conditionNodes,node)
|
||||
end
|
||||
LNode.SetParentNode (node, nil);
|
||||
end
|
||||
|
||||
function LSequenceNode:OnConditionNodesUpdate()
|
||||
if(#self.conditionNodes == 0) then
|
||||
return TaskState.Success
|
||||
end
|
||||
local node,state
|
||||
for i=1,#self.conditionNodes do
|
||||
node = self.conditionNodes [i]
|
||||
state = node:Update()
|
||||
if(state == TaskState.Failure) then
|
||||
return state
|
||||
end
|
||||
end
|
||||
return TaskState.Success
|
||||
end
|
||||
|
||||
function LSequenceNode:OnChildrenNodesUpdate()
|
||||
if(#self.childrenNodes == 0) then
|
||||
return TaskState.Success
|
||||
end
|
||||
local node,state
|
||||
for i=1,#self.childrenNodes do
|
||||
node = self.childrenNodes [i]
|
||||
state = node:Update()
|
||||
if (state == TaskState.Failure) then
|
||||
return state
|
||||
end
|
||||
end
|
||||
return state
|
||||
end
|
||||
|
||||
function LSequenceNode:Update()
|
||||
local result = self:OnConditionNodesUpdate()
|
||||
-- print("sequence",result)
|
||||
if(result == TaskState.Success) then
|
||||
result = self:OnChildrenNodesUpdate ()
|
||||
end
|
||||
return result
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6dfae60ec9d4e491baeed00f5277424d
|
||||
timeCreated: 1439448146
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Bgm.meta
Normal file
10
Assets/Resources/Script/Com/Bgm.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 663b02563228649a9812732789809f82
|
||||
folderAsset: yes
|
||||
timeCreated: 1465291746
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
152
Assets/Resources/Script/Com/Bgm/BgmCtrl.txt
Normal file
152
Assets/Resources/Script/Com/Bgm/BgmCtrl.txt
Normal file
@ -0,0 +1,152 @@
|
||||
BgmCtrl = class('BgmCtrl')
|
||||
|
||||
--interval:毫秒
|
||||
function BgmCtrl:ctor(audioSource,bgmType,playTimes,checkInterval,finishCallback)
|
||||
self.isPaused = false
|
||||
self.checkInterval = checkInterval
|
||||
self.bgmType = bgmType
|
||||
self.maxVolume = 1
|
||||
self.fadeDuration = 1.5
|
||||
self.mute = false
|
||||
self.playTimes = playTimes and playTimes or 1
|
||||
self.looptime = 0
|
||||
self:SetAudioSource(audioSource,self.playTimes==0)
|
||||
if self.checkInterval == nil then
|
||||
self.checkInterval = 1000
|
||||
end
|
||||
self.callback = finishCallback
|
||||
end
|
||||
|
||||
function BgmCtrl:SetAudioSource(audioSource,loop)
|
||||
if(Slua.IsNull(audioSource)==false) then
|
||||
self.audioSource = audioSource
|
||||
if(loop==nil) then
|
||||
loop = true
|
||||
end
|
||||
self.audioSource.loop = loop
|
||||
self.audioSource.mute = self.mute
|
||||
self:SetMaxVolume(self.maxVolume)
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:SetMute(val)
|
||||
if(self.mute~=val) then
|
||||
self.mute = val
|
||||
if(Slua.IsNull(self.audioSource)==false) then
|
||||
self.audioSource.mute = self.mute
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:SetMaxVolume(v)
|
||||
self.maxVolume = v
|
||||
if(Slua.IsNull(self.audioSource)==false) then
|
||||
if(self.audioSource.volume>=v) then
|
||||
self.audioSource.volume = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:SetVolume(volume)
|
||||
if(Slua.IsNull(self.audioSource)==false) then
|
||||
self.audioSource.volume = math.min(volume,self.maxVolume)
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:GetVolume()
|
||||
if(Slua.IsNull(self.audioSource)==false) then
|
||||
return self.audioSource.volume
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function BgmCtrl:SetProgress(progress)
|
||||
if(Slua.IsNull(self.audioSource)==false) then
|
||||
progress = math.clamp(progress,0,self.audioSource.clip.length-1)
|
||||
self.audioSource.time = progress
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:SetFinishCallback(finishCallback)
|
||||
self.callback = finishCallback
|
||||
end
|
||||
|
||||
function BgmCtrl:Play()
|
||||
if(Slua.IsNull(self.audioSource)==false) then
|
||||
self.audioSource:Play()
|
||||
end
|
||||
|
||||
if self.timeTick == nil and self.playTimes>0 then
|
||||
self.timeTick = TimeTickManager.Me():CreateTick(0,self.checkInterval,self.IsFinish,self)
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:Pause(fade)
|
||||
if(Slua.IsNull(self.audioSource)==false and not self.isPaused) then
|
||||
self.isPaused = true
|
||||
if(fade) then
|
||||
self:FadeFromTo(self:GetVolume(),0,nil,function ()
|
||||
self.audioSource:Pause()
|
||||
end)
|
||||
else
|
||||
self.audioSource:Pause()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:UnPause(fade)
|
||||
if(Slua.IsNull(self.audioSource)==false and self.isPaused) then
|
||||
self.isPaused = false
|
||||
self.audioSource:UnPause()
|
||||
if(fade) then
|
||||
self:FadeFromTo(0,1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:Stop()
|
||||
if(Slua.IsNull(self.audioSource)==false) then
|
||||
self.audioSource:Stop()
|
||||
end
|
||||
TimeTickManager.Me():ClearTick(self)
|
||||
self.timeTick = nil
|
||||
end
|
||||
|
||||
function BgmCtrl:IsFinish()
|
||||
if Slua.IsNull(self.audioSource)==false and not self.audioSource.isPlaying and not self.isPaused then
|
||||
self.looptime = self.looptime + 1
|
||||
if(self.looptime>=self.playTimes) then
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
else
|
||||
self:Play()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:IsPlaying()
|
||||
return Slua.IsNull(self.audioSource)==false and self.audioSource.isPlaying or false
|
||||
end
|
||||
|
||||
function BgmCtrl:FadeFromTo(from,to,duration,fadeDoneCall)
|
||||
duration = duration and duration or self.fadeDuration
|
||||
to = math.min(to,self.maxVolume)
|
||||
from = math.min(from,self.maxVolume)
|
||||
if(self.audioSource) then
|
||||
LeanTween.cancel(self.audioSource.gameObject)
|
||||
LeanTween.value (self.audioSource.gameObject, function (v)
|
||||
self.audioSource.volume = v
|
||||
end, from,to, duration):setDestroyOnComplete (true):setOnComplete (fadeDoneCall)
|
||||
end
|
||||
end
|
||||
|
||||
function BgmCtrl:Destroy()
|
||||
self:Stop()
|
||||
if(Slua.IsNull(self.audioSource)==false) then
|
||||
LeanTween.cancel(self.audioSource.gameObject)
|
||||
GameObject.Destroy(self.audioSource.gameObject)
|
||||
end
|
||||
self.audioSource = nil
|
||||
self.callback = nil
|
||||
end
|
9
Assets/Resources/Script/Com/Bgm/BgmCtrl.txt.meta
Normal file
9
Assets/Resources/Script/Com/Bgm/BgmCtrl.txt.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d8cc3b4dc981420999d6d72996ffa0a
|
||||
timeCreated: 1465291766
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Camp.meta
Normal file
10
Assets/Resources/Script/Com/Camp.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 618065274afa34543a0ad2690590f243
|
||||
folderAsset: yes
|
||||
timeCreated: 1462434088
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
92
Assets/Resources/Script/Com/Camp/CampHandler.txt
Normal file
92
Assets/Resources/Script/Com/Camp/CampHandler.txt
Normal file
@ -0,0 +1,92 @@
|
||||
CampHandler = class("CampHandler")
|
||||
|
||||
if(CampHandler.CampPriority==nil) then
|
||||
--陣營獲取的優先順序,按位做,從低到高
|
||||
CampHandler.CampPriority =
|
||||
{
|
||||
SelfTransformedAtk = {priority = 0,camp = RoleDefines_Camp.ENEMY},
|
||||
OtherTransformedAtk = {priority = 1,camp = RoleDefines_Camp.ENEMY},
|
||||
SameTeam = {priority = 2,camp = RoleDefines_Camp.FRIEND},
|
||||
PVPScene = {priority = 3,camp = RoleDefines_Camp.ENEMY},
|
||||
SameGuild = {priority = 4,camp = RoleDefines_Camp.FRIEND},
|
||||
GVGScene = {priority = 5,camp = RoleDefines_Camp.ENEMY},
|
||||
Normal = {priority = 6,camp = RoleDefines_Camp.FRIEND},
|
||||
}
|
||||
|
||||
CampHandler.BitIndexs = {}
|
||||
CampHandler.BitMapCamp = {}
|
||||
|
||||
for k,v in pairs(CampHandler.CampPriority) do
|
||||
CampHandler.BitIndexs[#CampHandler.BitIndexs + 1] = v.priority
|
||||
CampHandler.BitMapCamp[v.priority] = v.camp
|
||||
end
|
||||
table.sort(CampHandler.BitIndexs)
|
||||
end
|
||||
|
||||
function CampHandler:ctor(defaultCamp)
|
||||
self.defaultCamp = defaultCamp
|
||||
self:Reset()
|
||||
end
|
||||
|
||||
function CampHandler:SetBitValue(bit,val)
|
||||
local newValue = self.value
|
||||
if(val) then
|
||||
newValue = BitUtil.setbit(self.value,bit)
|
||||
else
|
||||
newValue = BitUtil.unsetbit(self.value,bit)
|
||||
end
|
||||
if(newValue~=self.value) then
|
||||
self.value = newValue
|
||||
self.dirty = true
|
||||
end
|
||||
end
|
||||
|
||||
function CampHandler:Reset()
|
||||
self.dirty = false
|
||||
self.camp = self.defaultCamp ~=nil and self.defaultCamp or RoleDefines_Camp.FRIEND
|
||||
self.value = 0
|
||||
if(self.defaultCamp == nil) then
|
||||
self:SetBitValue(CampHandler.CampPriority.Normal.priority,true)
|
||||
end
|
||||
end
|
||||
|
||||
function CampHandler:GetCamp()
|
||||
if(self.dirty) then
|
||||
self.dirty = false
|
||||
local index
|
||||
for i=1,#CampHandler.BitIndexs do
|
||||
index = CampHandler.BitIndexs[i]
|
||||
if(BitUtil.valid(self.value,index)) then
|
||||
if(BitUtil.band(self.value,index)>0) then
|
||||
self.camp = CampHandler.BitMapCamp[index]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return self.camp
|
||||
end
|
||||
|
||||
function CampHandler:SetIsInPvpScene(val)
|
||||
self:SetBitValue(CampHandler.CampPriority.PVPScene.priority,val)
|
||||
end
|
||||
|
||||
function CampHandler:SetIsSelfTransformedAtk(val)
|
||||
self:SetBitValue(CampHandler.CampPriority.SelfTransformedAtk.priority,val)
|
||||
end
|
||||
|
||||
function CampHandler:SetIsOtherTransformedAtk(val)
|
||||
self:SetBitValue(CampHandler.CampPriority.OtherTransformedAtk.priority,val)
|
||||
end
|
||||
|
||||
function CampHandler:SetIsSameTeam(val)
|
||||
self:SetBitValue(CampHandler.CampPriority.SameTeam.priority,val)
|
||||
end
|
||||
|
||||
function CampHandler:SetIsSameGuild(val)
|
||||
self:SetBitValue(CampHandler.CampPriority.SameGuild.priority,val)
|
||||
end
|
||||
|
||||
function CampHandler:SetIsInGVGScene(val)
|
||||
self:SetBitValue(CampHandler.CampPriority.GVGScene.priority,val)
|
||||
end
|
9
Assets/Resources/Script/Com/Camp/CampHandler.txt.meta
Normal file
9
Assets/Resources/Script/Com/Camp/CampHandler.txt.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08b4a969df96b4578bbeb5784814ed4f
|
||||
timeCreated: 1462434097
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Carrier.meta
Normal file
10
Assets/Resources/Script/Com/Carrier.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa6d81870df5d42afa049fe52068e227
|
||||
folderAsset: yes
|
||||
timeCreated: 1439265779
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
297
Assets/Resources/Script/Com/Carrier/LCarrier.txt
Normal file
297
Assets/Resources/Script/Com/Carrier/LCarrier.txt
Normal file
@ -0,0 +1,297 @@
|
||||
LCarrier = reusableClass('LCarrier')
|
||||
LCarrier.PoolSize = 10
|
||||
|
||||
LCarrier.Status = {
|
||||
Wait = 0,
|
||||
Moving = 1,
|
||||
Arrived = 2
|
||||
}
|
||||
|
||||
LCarrier.MasterSeat = -1
|
||||
local tmpPos = LuaVector3.zero
|
||||
function LCarrier:ctor()
|
||||
LCarrier.super.ctor(self)
|
||||
self.member = {}
|
||||
end
|
||||
|
||||
-- override begin
|
||||
function LCarrier:DoConstruct(asArray, serverData)
|
||||
self.myselfID = Game.Myself.data.id
|
||||
self.status = LCarrier.Status.Wait
|
||||
self.iAmMaster = false
|
||||
self.isMine = false
|
||||
self.masterID = 0
|
||||
self.carrierID = -1
|
||||
self.line = -1
|
||||
self.progress = 0
|
||||
self.destroyed = false
|
||||
end
|
||||
|
||||
function LCarrier:DoDeconstruct(asArray)
|
||||
end
|
||||
-- override end
|
||||
|
||||
function LCarrier:SetIsMine(value)
|
||||
if(self.isMine~=value) then
|
||||
self.isMine = value
|
||||
if(self.carrier) then
|
||||
if(value) then
|
||||
if(self:IsWaiting()) then
|
||||
self:Visible(true)
|
||||
end
|
||||
self.carrier.progressListener = function (info)
|
||||
-- print("sync carrier move")
|
||||
ServiceCarrierCmdProxy.Instance:CallCarrierMoveUserCmd(info.position,info.progress*100)
|
||||
end
|
||||
self.carrier.arrivedListener = function (info)
|
||||
-- print("my arrived!")
|
||||
self:Arrive()
|
||||
ServiceCarrierCmdProxy.Instance:CallReachCarrierUserCmd(info.position)
|
||||
end
|
||||
else
|
||||
self.carrier.progressListener = nil
|
||||
self.carrier.arrivedListener = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:Visible(value)
|
||||
if(self.carrier) then
|
||||
if(not value) then
|
||||
GameObjectUtil.Instance:ChangeLayersRecursively(self.carrier.gameObject,RO.Config.Layer.INVISIBLE.Value)
|
||||
else
|
||||
GameObjectUtil.Instance:ChangeLayersRecursively(self.carrier.gameObject,RO.Config.Layer.DEFAULT.Value)
|
||||
end
|
||||
-- self.carrier.gameObject:SetActive(value)
|
||||
end
|
||||
self.visiblity = value
|
||||
local passenger
|
||||
for k,v in pairs(self.member) do
|
||||
passenger = SceneCreatureProxy.FindCreature(k)
|
||||
self:_VisiblePlayer(passenger,value)
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:_VisiblePlayer( player , value )
|
||||
if(player) then
|
||||
player:SetVisible(value,LayerChangeReason.CarrierWaiting)
|
||||
self:_VisiblePlayerUI(player , value)
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:_VisiblePlayerUI(player,value)
|
||||
if(value) then
|
||||
FunctionPlayerUI.Me():UnMaskAllUI(player,PUIVisibleReason.CarrierWait)
|
||||
else
|
||||
FunctionPlayerUI.Me():MaskAllUI(player,PUIVisibleReason.CarrierWait)
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:SetIAmMaster(value)
|
||||
if(self.iAmMaster~=value) then
|
||||
self.iAmMaster = value
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:CreateBus()
|
||||
if(self.carrier == nil) then
|
||||
if(self.carrierID>0)then
|
||||
self.carrier = BusManager.Instance:CloneBus(self.carrierID)
|
||||
self:Visible(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:DestroyCarrier(pos)
|
||||
self.destroyed = true
|
||||
if(self.carrier) then
|
||||
local passenger
|
||||
for k,v in pairs(self.member) do
|
||||
self:GetOff(k,pos)
|
||||
end
|
||||
if(self.carrier and not GameObjectUtil.Instance:ObjectIsNULL(self.carrier.gameObject)) then
|
||||
-- LogUtility.InfoFormat("載具%s被銷燬 name:%s",self.masterID,self.carrier.gameObject.name)
|
||||
if(not self.isMine) then
|
||||
GameObject.Destroy(self.carrier.gameObject)
|
||||
end
|
||||
end
|
||||
self.carrier = nil
|
||||
end
|
||||
if(not self.isMine) then
|
||||
self:Destroy()
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:IsWaiting()
|
||||
return self.status == LCarrier.Status.Wait
|
||||
end
|
||||
|
||||
function LCarrier:IsMoving()
|
||||
return self.status == LCarrier.Status.Moving
|
||||
end
|
||||
|
||||
function LCarrier:Reset(masterID,carrierID)
|
||||
self.masterID = masterID
|
||||
self.carrierID = carrierID or self.carrierID
|
||||
self:CreateBus()
|
||||
self:SetIAmMaster(self.masterID == self.myselfID)
|
||||
end
|
||||
|
||||
function LCarrier:StartMove()
|
||||
if(self.status~=LCarrier.Status.Moving) then
|
||||
self.status = LCarrier.Status.Moving
|
||||
self:Visible(true)
|
||||
self.carrier:GO(self.line,self.progress)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function LCarrier:Arrive()
|
||||
self.status = LCarrier.Status.Arrived
|
||||
end
|
||||
|
||||
function LCarrier:GetOn(memberID,index,needAnim)
|
||||
local oldIndex = self.member[memberID]
|
||||
if(memberID == self.myselfID) then self:SetIsMine(true) end
|
||||
self.member[memberID] = index
|
||||
SceneCarrierProxy.Instance:SetInCarrier(memberID,self)
|
||||
if(self.carrier) then
|
||||
if(oldIndex~=nil or memberID ~= self.myselfID) then
|
||||
--換位置或者其他人坐上來
|
||||
local passenger = SceneCreatureProxy.FindCreature(memberID)
|
||||
self:_GetOn(passenger,index)
|
||||
else
|
||||
Game.Myself:SetOnCarrier(true)
|
||||
--我自己首次乘坐行為
|
||||
FunctionBus.Me():Launch(self.carrier,self.carrierID, index,needAnim)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:MyForceLeave(pos)
|
||||
if pos then
|
||||
ProtolUtility.Better_S2C_Vector3(pos, tmpPos)
|
||||
else
|
||||
tmpPos[1],tmpPos[2],tmpPos[3] = 0,0,0
|
||||
end
|
||||
SceneCarrierProxy.Instance:SetInCarrier(self.myselfID,nil)
|
||||
self.member[self.myselfID] = nil
|
||||
if(self.carrier) then
|
||||
if(self.myselfID ~= self.masterID and not self.destroyed) then
|
||||
FunctionBus.Me():SetBusNil()
|
||||
else
|
||||
print("銷燬我自己的載具")
|
||||
end
|
||||
FunctionBus.Me():Shutdown(tmpPos,function()
|
||||
Game.Myself:SetOnCarrier(false)
|
||||
self:SetIsMine(false)
|
||||
self:Visible(false)
|
||||
if(self.destroyed) then
|
||||
self:Destroy()
|
||||
end
|
||||
end,true)
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:GetOff(memberID,pos)
|
||||
if pos then
|
||||
ProtolUtility.Better_S2C_Vector3(pos, tmpPos)
|
||||
else
|
||||
tmpPos[1],tmpPos[2],tmpPos[3] = 0,0,0
|
||||
end
|
||||
self.member[memberID] = nil
|
||||
-- print(pos.x,pos.y,pos.z)
|
||||
SceneCarrierProxy.Instance:SetInCarrier(memberID,nil)
|
||||
if(self.carrier) then
|
||||
if(memberID == self.myselfID) then
|
||||
if(self.myselfID ~= self.masterID and not self.destroyed) then
|
||||
FunctionBus.Me():SetBusNil()
|
||||
else
|
||||
print("銷燬我自己的載具")
|
||||
end
|
||||
FunctionBus.Me():Shutdown(tmpPos,function ()
|
||||
Game.Myself:SetOnCarrier(false)
|
||||
self:SetIsMine(false)
|
||||
self:Visible(false)
|
||||
if(self.destroyed) then
|
||||
self:Destroy()
|
||||
end
|
||||
end)
|
||||
else
|
||||
local passenger = SceneCreatureProxy.FindCreature(memberID)
|
||||
self:_GetOff(passenger,tmpPos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:_GetOn(creature,seatID)
|
||||
if(creature) then
|
||||
local seat = self.carrier:GetSeat(seatID)
|
||||
if(seat) then
|
||||
creature:SetOnCarrier(true)
|
||||
-- 0 坐下
|
||||
creature.assetRole:PlayAction_Sitdown()
|
||||
-- 1 setparent
|
||||
creature:SetParent(seat.transform)
|
||||
-- 2 去掉陰影
|
||||
creature.assetRole:SetShadowEnable(false)
|
||||
-- 3 角度設0
|
||||
creature:Client_SetDirCmd(AI_CMD_SetAngleY.Mode.SetAngleY,0,true)
|
||||
end
|
||||
self:_VisiblePlayer(creature,self.visiblity)
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:_GetOff(creature,pos)
|
||||
if(creature) then
|
||||
creature:SetOnCarrier(false)
|
||||
FunctionSystem.InterruptCreature(creature)
|
||||
-- 1 陰影整回來
|
||||
creature.assetRole:SetShadowEnable(true)
|
||||
-- 2
|
||||
creature:SetParent(nil)
|
||||
-- 3
|
||||
pos = pos or creature:GetPosition()
|
||||
creature:Client_PlaceXYZTo(pos[1],pos[2],pos[3])
|
||||
|
||||
self:_VisiblePlayer(creature,true)
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:SetProgress(progress)
|
||||
self.progress = progress
|
||||
if(self.carrier and self:IsMoving()) then
|
||||
self.carrier:GO(self.line,self.progress)
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:AllGetOffAtOnce()
|
||||
local passenger
|
||||
local pos
|
||||
for id,index in pairs(self.member) do
|
||||
passenger = SceneCreatureProxy.FindCreature(id)
|
||||
if(passenger) then
|
||||
self:_GetOff(passenger)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:AllReGetOn()
|
||||
local passenger
|
||||
local pos
|
||||
for id,index in pairs(self.member) do
|
||||
passenger = SceneCreatureProxy.FindCreature(id)
|
||||
self:_GetOn(passenger,index)
|
||||
end
|
||||
end
|
||||
|
||||
function LCarrier:ChangeCarrier(carrierID)
|
||||
if(carrierID~=self.carrierID) then
|
||||
self.carrierID = carrierID
|
||||
self:AllGetOffAtOnce()
|
||||
self.carrier:SResetAllCarriers(ResourcePathHelper.BusCarrier(carrierID))
|
||||
self:AllReGetOn()
|
||||
end
|
||||
end
|
9
Assets/Resources/Script/Com/Carrier/LCarrier.txt.meta
Normal file
9
Assets/Resources/Script/Com/Carrier/LCarrier.txt.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 235a02f6762af4f03847d147c4031ce3
|
||||
timeCreated: 1439265785
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Condition.meta
Normal file
10
Assets/Resources/Script/Com/Condition.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 784c06ec5c7a042348c3d487b6809c36
|
||||
folderAsset: yes
|
||||
timeCreated: 1440053033
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
130
Assets/Resources/Script/Com/Condition/ConditionCheck.txt
Normal file
130
Assets/Resources/Script/Com/Condition/ConditionCheck.txt
Normal file
@ -0,0 +1,130 @@
|
||||
ConditionCheck = class('ConditionCheck')
|
||||
local TableClear = TableUtility.TableClear
|
||||
function ConditionCheck:ctor()
|
||||
self.reasons = {}
|
||||
self:Reset()
|
||||
end
|
||||
|
||||
function ConditionCheck:Reset()
|
||||
TableClear(self.reasons)
|
||||
self.dirty = false
|
||||
self.hasReason = false
|
||||
self.reasonCount = 0
|
||||
end
|
||||
|
||||
function ConditionCheck:IsDirty()
|
||||
return self.dirty
|
||||
end
|
||||
|
||||
function ConditionCheck:HasReason()
|
||||
if(self.dirty) then
|
||||
self.hasReason = false
|
||||
for k,v in pairs(self.reasons) do
|
||||
self.hasReason = true
|
||||
break
|
||||
end
|
||||
end
|
||||
return self.hasReason
|
||||
end
|
||||
|
||||
function ConditionCheck:SetReason(reason)
|
||||
-- printOrange("加上reason"..reason)
|
||||
if(self.reasons[reason] == nil) then
|
||||
self.reasons[reason] = reason
|
||||
self.hasReason = true
|
||||
self.reasonCount = self.reasonCount + 1
|
||||
end
|
||||
end
|
||||
|
||||
function ConditionCheck:RemoveReason(reason)
|
||||
-- printOrange("移除reason"..reason)
|
||||
if(self.reasons[reason] ~= nil) then
|
||||
self.reasons[reason] = nil
|
||||
self.dirty = true
|
||||
self.reasonCount = self.reasonCount - 1
|
||||
end
|
||||
end
|
||||
|
||||
ConditionCheckWithDirty = class('ConditionCheckWithDirty',ConditionCheck)
|
||||
|
||||
function ConditionCheckWithDirty:ctor(dirty)
|
||||
self.reasons = {}
|
||||
self:Reset()
|
||||
if(dirty == nil) then dirty = false end
|
||||
self.dirty = dirty
|
||||
end
|
||||
|
||||
function ConditionCheckWithDirty:HasReason()
|
||||
if(self.dirty) then
|
||||
self.hasReason = false
|
||||
for k,v in pairs(self.reasons) do
|
||||
self.hasReason = true
|
||||
break
|
||||
end
|
||||
self.dirty = false
|
||||
end
|
||||
return self.hasReason
|
||||
end
|
||||
|
||||
function ConditionCheckWithDirty:SetReason(reason)
|
||||
-- printOrange("加上reason"..reason)
|
||||
if(self.reasons[reason]~=reason) then
|
||||
self.reasons[reason] = reason
|
||||
self.hasReason = true
|
||||
self.dirty = true
|
||||
end
|
||||
end
|
||||
|
||||
function ConditionCheckWithDirty:RemoveReason(reason)
|
||||
-- printOrange("移除reason"..reason)
|
||||
if(self.reasons[reason]~=nil) then
|
||||
self.reasons[reason] = nil
|
||||
self.dirty = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--帶有 與,或 性質的ConditionCheckWithDirty
|
||||
LogicalConditionCheckWithDirty = class("LogicalConditionCheckWithDirty",ConditionCheckWithDirty)
|
||||
LogicalConditionCheckWithDirty.And = "&&"
|
||||
LogicalConditionCheckWithDirty.Or = "||"
|
||||
|
||||
function LogicalConditionCheckWithDirty:ctor(logic)
|
||||
self.logic = logic
|
||||
if(logic ~= LogicalConditionCheckWithDirty.Or and logic ~= LogicalConditionCheckWithDirty.And) then
|
||||
self.logic = LogicalConditionCheckWithDirty.And
|
||||
end
|
||||
LogicalConditionCheckWithDirty.super.ctor(self)
|
||||
end
|
||||
|
||||
function LogicalConditionCheckWithDirty:HasReason()
|
||||
if(self.dirty) then
|
||||
local cond = self.logic == LogicalConditionCheckWithDirty.Or
|
||||
self.hasReason = not cond
|
||||
for k,v in pairs(self.reasons) do
|
||||
if(v==cond) then
|
||||
self.hasReason = cond
|
||||
break
|
||||
end
|
||||
end
|
||||
self.dirty = false
|
||||
end
|
||||
return self.hasReason
|
||||
end
|
||||
|
||||
function LogicalConditionCheckWithDirty:SetReason(reason)
|
||||
-- printOrange("加上reason"..reason)
|
||||
if(self.reasons[reason]~=true) then
|
||||
self.reasons[reason] = true
|
||||
self.hasReason = true
|
||||
self.dirty = true
|
||||
end
|
||||
end
|
||||
|
||||
function LogicalConditionCheckWithDirty:RemoveReason(reason)
|
||||
-- printOrange("移除reason"..reason)
|
||||
if(self.reasons[reason]~=false) then
|
||||
self.reasons[reason] = false
|
||||
self.dirty = true
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eaa03180d9bb04b68a240dcf627013cb
|
||||
timeCreated: 1440053036
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Data.meta
Normal file
10
Assets/Resources/Script/Com/Data.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 828d988da7b9d437584b4b48f332a15d
|
||||
folderAsset: yes
|
||||
timeCreated: 1429520691
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Data/Activity.meta
Normal file
10
Assets/Resources/Script/Com/Data/Activity.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 197ef1f1146a64b1183a86cfe1840e7b
|
||||
folderAsset: yes
|
||||
timeCreated: 1504087097
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,48 @@
|
||||
ActivityGroupData = class("ActivityGroupData")
|
||||
|
||||
function ActivityGroupData:ctor(serverData)
|
||||
self:updateData(serverData)
|
||||
end
|
||||
|
||||
function ActivityGroupData:updateData( serverData )
|
||||
-- body
|
||||
self.id = serverData.id
|
||||
self.name = serverData.name
|
||||
self.iconurl = self:getMultLanContent(serverData,"iconurl")
|
||||
self.begintime = serverData.begintime
|
||||
self.endtime = serverData.endtime
|
||||
self.url = self:getMultLanContent(serverData,"url")
|
||||
self.countdown = serverData.countdown
|
||||
local sub_activity = serverData.sub_activity
|
||||
|
||||
if(#sub_activity>0)then
|
||||
local sub_activity_ = {}
|
||||
for i=1,#sub_activity do
|
||||
local singleSub = sub_activity[i]
|
||||
local subData = ActivitySubData.new(singleSub)
|
||||
sub_activity_[#sub_activity_ +1 ] = subData
|
||||
end
|
||||
self.sub_activity = sub_activity_
|
||||
end
|
||||
end
|
||||
|
||||
function ActivityGroupData:getMultLanContent( serverData,key )
|
||||
if(serverData[key] and serverData[key] ~= "")then
|
||||
return serverData[key]
|
||||
end
|
||||
|
||||
local lanData = serverData.data
|
||||
lanData = lanData[key]
|
||||
|
||||
if(not lanData)then
|
||||
return ""
|
||||
end
|
||||
|
||||
local language = ApplicationInfo.GetSystemLanguage()
|
||||
for i=1,#lanData do
|
||||
local single = lanData[i]
|
||||
if(single.language == language)then
|
||||
return single.url
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b956b853e295648309bb292295ba533e
|
||||
timeCreated: 1502702331
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,37 @@
|
||||
ActivitySubData = class("ActivitySubData")
|
||||
|
||||
function ActivitySubData:ctor(serverData)
|
||||
self:updateData(serverData)
|
||||
end
|
||||
|
||||
function ActivitySubData:updateData( serverData )
|
||||
-- body
|
||||
self.id = serverData.id
|
||||
self.name = serverData.name
|
||||
self.begintime = serverData.begintime
|
||||
self.endtime = serverData.endtime
|
||||
self.pathtype = serverData.pathtype
|
||||
self.pathevent = serverData.pathevent
|
||||
self.url = self:getMultLanContent(serverData,"url")
|
||||
self.pic_url = self:getMultLanContent(serverData,"pic_url")
|
||||
self.groupid = serverData.groupid
|
||||
end
|
||||
|
||||
function ActivitySubData:getMultLanContent( serverData,key )
|
||||
if(serverData[key] and serverData[key] ~= "")then
|
||||
return serverData[key]
|
||||
end
|
||||
|
||||
local lanData = serverData.data
|
||||
lanData = lanData[key]
|
||||
if(not lanData)then
|
||||
return ""
|
||||
end
|
||||
local language = ApplicationInfo.GetSystemLanguage()
|
||||
for i=1,#lanData do
|
||||
local single = lanData[i]
|
||||
if(single.language == language)then
|
||||
return single.url
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b52fe538445a44947b05b7e80469486d
|
||||
timeCreated: 1502702331
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Data/ActivityEvent.meta
Normal file
10
Assets/Resources/Script/Com/Data/ActivityEvent.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aba866367d2244e6caadfe47a0ac1277
|
||||
folderAsset: yes
|
||||
timeCreated: 1511750141
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,72 @@
|
||||
AEFreeTransferData = class("AEFreeTransferData")
|
||||
|
||||
function AEFreeTransferData:ctor(data)
|
||||
self.mapids = {}
|
||||
self.teammapids = {}
|
||||
|
||||
self:SetData(data)
|
||||
end
|
||||
|
||||
function AEFreeTransferData:SetData(data)
|
||||
if data ~= nil then
|
||||
self.allfree = data.allfree
|
||||
self.teamallfree = data.teamallfree
|
||||
TableUtility.TableClear(self.mapids)
|
||||
for i=1,#data.mapids do
|
||||
local id = data.mapids[i]
|
||||
self.mapids[id] = id
|
||||
redlog("set mapid",id)
|
||||
end
|
||||
|
||||
for i=1,#data.teammapids do
|
||||
local id = data.teammapids[i]
|
||||
self.teammapids[id] = id
|
||||
end
|
||||
|
||||
self.storefree = data.storefree;
|
||||
end
|
||||
end
|
||||
|
||||
--設定活動開始和結束時間
|
||||
function AEFreeTransferData:SetTime(data)
|
||||
self.beginTime = data.begintime
|
||||
self.endTime = data.endtime
|
||||
end
|
||||
|
||||
function AEFreeTransferData:IsExist(mapid,Ftype)
|
||||
if Ftype == UIMapMapList.E_TransmitType.Team then
|
||||
return self.teammapids[mapid] ~= nil
|
||||
end
|
||||
if Ftype == UIMapMapList.E_TransmitType.Single then
|
||||
return self.mapids[mapid] ~= nil
|
||||
end
|
||||
end
|
||||
|
||||
--判斷是否在活動時間內
|
||||
function AEFreeTransferData:IsInActivity()
|
||||
if self.beginTime ~= nil and self.endTime ~= nil then
|
||||
local server = ServerTime.CurServerTime()/1000
|
||||
return server >= self.beginTime and server <= self.endTime
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function AEFreeTransferData:IsFreeTransferMap(mapid,Ftype)
|
||||
if self:IsInActivity() then
|
||||
if Ftype == UIMapMapList.E_TransmitType.Team and self.teamallfree then
|
||||
return true
|
||||
end
|
||||
if Ftype == UIMapMapList.E_TransmitType.Single and self.allfree then
|
||||
return true
|
||||
end
|
||||
return self:IsExist(mapid,Ftype)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function AEFreeTransferData:IsStorageFree()
|
||||
if self:IsInActivity() then
|
||||
return self.storefree
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 172614e7d30cb4971bedf3dbe1d99b1a
|
||||
timeCreated: 1508143399
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,63 @@
|
||||
AEGuildBuildingData = class("AEGuildBuildingData")
|
||||
|
||||
function AEGuildBuildingData:ctor(data)
|
||||
self.types = {}
|
||||
|
||||
self:SetData(data)
|
||||
end
|
||||
|
||||
function AEGuildBuildingData:SetData(data)
|
||||
if data ~= nil then
|
||||
TableUtility.TableClear(self.types)
|
||||
local length = #data.types
|
||||
for i=1,length do
|
||||
local typeID = data.types[i]
|
||||
self.types[typeID] = typeID
|
||||
end
|
||||
self.minlv = data.minlv
|
||||
self.maxlv = data.maxlv
|
||||
self.submitinc = data.submitinc
|
||||
self.rewardinc = data.rewardinc
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function AEGuildBuildingData:SetTime(data)
|
||||
self.beginTime = data.begintime
|
||||
self.endTime = data.endtime
|
||||
end
|
||||
|
||||
--判斷是否在活動時間內
|
||||
function AEGuildBuildingData:IsInActivity()
|
||||
if self.beginTime ~= nil and self.endTime ~= nil then
|
||||
local server = ServerTime.CurServerTime()/1000
|
||||
return server >= self.beginTime and server <= self.endTime
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- 判斷是否符合等級要求
|
||||
function AEGuildBuildingData:CheckEffectByGuildBuildingLevel(gLevel)
|
||||
if gLevel >= self.minlv and gLevel <= self.maxlv then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function AEGuildBuildingData:CheckEffectByGuildBuildingType(gType)
|
||||
if self.types and self.types[gType] then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function AEGuildBuildingData:GetSubmitInc()
|
||||
return self.submitinc
|
||||
end
|
||||
|
||||
function AEGuildBuildingData:GetRewardInc()
|
||||
return self.rewardinc
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c334ff28a3afe43558f1ebee41658b1b
|
||||
timeCreated: 1523427177
|
||||
licenseType: Free
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,48 @@
|
||||
AELotteryBannerData = class("AELotteryBannerData")
|
||||
|
||||
function AELotteryBannerData:ctor(data)
|
||||
|
||||
end
|
||||
|
||||
function AELotteryBannerData:SetData(data)
|
||||
if data ~= nil then
|
||||
self.id = data.id
|
||||
self.begintime = data.begintime
|
||||
self.endtime = data.endtime
|
||||
|
||||
local banner = data.lotterybanner
|
||||
self.type = banner.lotterytype
|
||||
self.path = self:getMultLanContent(banner,"path")
|
||||
end
|
||||
end
|
||||
|
||||
function AELotteryBannerData:IsInActivity()
|
||||
if self.begintime ~= nil and self.endtime ~= nil then
|
||||
local server = ServerTime.CurServerTime()/1000
|
||||
return server >= self.begintime and server <= self.endtime
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function AELotteryBannerData:GetPath()
|
||||
return self.path
|
||||
end
|
||||
|
||||
function AELotteryBannerData:getMultLanContent( serverData,key )
|
||||
if(serverData[key] and serverData[key] ~= "")then
|
||||
return serverData[key]
|
||||
end
|
||||
|
||||
local lanData = serverData.urls
|
||||
if(not lanData)then
|
||||
return ""
|
||||
end
|
||||
local language = ApplicationInfo.GetSystemLanguage()
|
||||
for i=1,#lanData do
|
||||
local single = lanData[i]
|
||||
if(single.language == language)then
|
||||
return single.url
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73a1b98ab2fee4af5b780fe096111f31
|
||||
timeCreated: 1518247970
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,93 @@
|
||||
autoImport("AELotteryDiscountData")
|
||||
autoImport("AELotteryBannerData")
|
||||
|
||||
AELotteryData = class("AELotteryData")
|
||||
|
||||
function AELotteryData:ctor(data)
|
||||
self.discountMap = {}
|
||||
self.bannerMap = {}
|
||||
end
|
||||
|
||||
function AELotteryData:SetDiscount(data)
|
||||
if data ~= nil then
|
||||
local lotterydiscount = data.lotterydiscount
|
||||
local lotterytype = lotterydiscount.lotterytype
|
||||
|
||||
local info = self:CheckIsExistDiscount(lotterydiscount)
|
||||
if info == nil then
|
||||
local discount = AELotteryDiscountData.new(data)
|
||||
TableUtility.ArrayPushBack(self.discountMap[lotterytype], discount)
|
||||
else
|
||||
info:SetData(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AELotteryData:SetBanner(data)
|
||||
if data ~= nil then
|
||||
local lotterytype = data.lotterybanner.lotterytype
|
||||
|
||||
if self.bannerMap[lotterytype] == nil then
|
||||
self.bannerMap[lotterytype] = AELotteryBannerData.new()
|
||||
end
|
||||
self.bannerMap[lotterytype]:SetData(data)
|
||||
end
|
||||
end
|
||||
|
||||
function AELotteryData:CheckIsExistDiscount(data)
|
||||
local lotterytype = data.lotterytype
|
||||
|
||||
if self.discountMap[lotterytype] == nil then
|
||||
self.discountMap[lotterytype] = {}
|
||||
return
|
||||
end
|
||||
|
||||
for i=1,#self.discountMap[lotterytype] do
|
||||
local info = self.discountMap[lotterytype][i]
|
||||
if data.yearmonth ~= 0 then
|
||||
if info.yearmonth == data.yearmonth and info.cointype == data.cointype then
|
||||
return info
|
||||
end
|
||||
elseif info.cointype == data.cointype then
|
||||
return info
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AELotteryData:GetDiscount(lotterytype)
|
||||
return self.discountMap[lotterytype]
|
||||
end
|
||||
|
||||
function AELotteryData:GetDiscountByCoinType(lotterytype, cointype, year, month)
|
||||
local list = self:GetDiscount(lotterytype)
|
||||
if list ~= nil then
|
||||
for i=1,#list do
|
||||
local data = list[i]
|
||||
if month ~= nil and year ~= nil then
|
||||
if data.month == month and data.year == year and data.cointype == cointype then
|
||||
return data
|
||||
end
|
||||
elseif data.cointype == cointype then
|
||||
return data
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AELotteryData:GetBannerPath(lotterytype)
|
||||
local data = self.bannerMap[lotterytype]
|
||||
if data ~= nil and data:IsInActivity() then
|
||||
return data:GetPath()
|
||||
end
|
||||
end
|
||||
|
||||
function AELotteryData:GetDiscountDataById(id)
|
||||
for k,v in pairs(self.discountMap) do
|
||||
for i=1,#v do
|
||||
local data = v[i]
|
||||
if data.id == id then
|
||||
return data
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eff23fac5e6724ec9b91cee1feddabf9
|
||||
timeCreated: 1518247970
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,51 @@
|
||||
AELotteryDiscountData = class("AELotteryDiscountData")
|
||||
|
||||
AELotteryDiscountData.CoinType = {
|
||||
Coin = ActivityEvent_pb.ECoinType_Coin,
|
||||
Ticket = ActivityEvent_pb.ECoinType_Ticket,
|
||||
}
|
||||
|
||||
function AELotteryDiscountData:ctor(data)
|
||||
self:SetData(data)
|
||||
end
|
||||
|
||||
function AELotteryDiscountData:SetData(data)
|
||||
if data ~= nil then
|
||||
self.id = data.id
|
||||
self.beginTime = data.begintime
|
||||
self.endTime = data.endtime
|
||||
|
||||
local discount = data.lotterydiscount
|
||||
self.type = discount.lotterytype
|
||||
self.cointype = discount.cointype --貨幣型別
|
||||
self.usertype = discount.usertype --適用對像
|
||||
self.discount = discount.discount --折扣,70表示7折
|
||||
self.count = discount.count --折扣次數
|
||||
self.yearmonth = discount.yearmonth
|
||||
self.year = math.floor(self.yearmonth / 100)
|
||||
self.month = self.yearmonth % 100
|
||||
self.usedCount = 0 --已用折扣次數
|
||||
end
|
||||
end
|
||||
|
||||
function AELotteryDiscountData:SetUsedCount(count)
|
||||
self.usedCount = count
|
||||
end
|
||||
|
||||
function AELotteryDiscountData:IsInActivity()
|
||||
if self.beginTime ~= nil and self.endTime ~= nil then
|
||||
local server = ServerTime.CurServerTime()/1000
|
||||
return server >= self.beginTime and server <= self.endTime
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
--獲取折扣值
|
||||
function AELotteryDiscountData:GetDiscount()
|
||||
if self:IsInActivity() and (self.count ~= 0 and self.usedCount < self.count) then
|
||||
return self.discount
|
||||
end
|
||||
|
||||
return 100
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4943f4266a84442bb9c3d1615521ecb
|
||||
timeCreated: 1518247970
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,20 @@
|
||||
AEResetData = class("AEResetData")
|
||||
|
||||
function AEResetData:ctor(data)
|
||||
self.map = {}
|
||||
end
|
||||
|
||||
function AEResetData:SetData(data)
|
||||
if data ~= nil then
|
||||
local mode = data.mode
|
||||
if mode == AERewardType.Tower then
|
||||
if self.rewardMap[mode] == nil then
|
||||
self.rewardMap[mode] = data.times
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AEResetData:GetDataByType(type)
|
||||
return self.map[type]
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 682715b555bb448129eb07879f94dbb8
|
||||
timeCreated: 1513327508
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,46 @@
|
||||
autoImport("AERewardInfoData")
|
||||
|
||||
AERewardData = class("AERewardData")
|
||||
|
||||
AERewardData.DebugString = {
|
||||
"研究所",
|
||||
"看板",
|
||||
"裂隙",
|
||||
"工會捐贈",
|
||||
"無限塔",
|
||||
}
|
||||
|
||||
|
||||
function AERewardData:ctor()
|
||||
self.rewardMap = {}
|
||||
end
|
||||
|
||||
function AERewardData:SetReward(data)
|
||||
if data ~= nil then
|
||||
local rewardData = data.reward
|
||||
for i=1,#rewardData do
|
||||
-- self.beginTime = data.begintime
|
||||
-- self.endTime = data.endtime
|
||||
local mode = rewardData[i].mode
|
||||
local logStr = "";
|
||||
logStr = "AERewardData --> ";
|
||||
local dateFormat = "%m月%d日%H點%M分%S秒";
|
||||
local modeStr = AERewardData.DebugString[mode]
|
||||
logStr = logStr .. string.format(" | 功能:%s | 開始時間:%s | 結束時間:%s | 目前時間:%s | 獎勵倍數:%s",
|
||||
tostring(modeStr),
|
||||
os.date(dateFormat, data.begintime),
|
||||
os.date(dateFormat, data.endtime),
|
||||
os.date(dateFormat, ServerTime.CurServerTime()/1000),
|
||||
tostring(rewardData[i].multiplereward.multiple));
|
||||
helplog(logStr);
|
||||
|
||||
self.rewardMap[mode] = AERewardInfoData.new(rewardData[i],data.begintime,data.endtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AERewardData:GetRewardByType(type)
|
||||
if self.rewardMap[type] and self.rewardMap[type]:IsInActivity() then
|
||||
return self.rewardMap[type]
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9932158f946fd404daf2299d044d6d22
|
||||
timeCreated: 1510902894
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,61 @@
|
||||
AERewardInfoData = class("AERewardInfoData")
|
||||
|
||||
function AERewardInfoData:ctor(data,begintime,endtime)
|
||||
self:SetData(data)
|
||||
self:SetTime(begintime,endtime)
|
||||
end
|
||||
|
||||
function AERewardInfoData:SetData(data)
|
||||
if data ~= nil then
|
||||
self.mode = data.mode
|
||||
self.multiple = data.multiplereward.multiple
|
||||
self.multipleDaylimit = data.multiplereward.daylimit
|
||||
self.multipleAcclimit = data.multiplereward.acclimit
|
||||
self.extratimes = data.extratimes
|
||||
end
|
||||
end
|
||||
|
||||
function AERewardInfoData:SetTime(begintime,endtime)
|
||||
self.beginTime = begintime
|
||||
self.endTime = endtime
|
||||
end
|
||||
|
||||
function AERewardInfoData:IsInActivity()
|
||||
if self.beginTime ~= nil and self.endTime ~= nil then
|
||||
local server = ServerTime.CurServerTime()/1000
|
||||
return server >= self.beginTime and server <= self.endTime
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function AERewardInfoData:CheckMultipleReward()
|
||||
local _ActivityEventProxy = ActivityEventProxy.Instance
|
||||
local userData = _ActivityEventProxy:GetUserDataByType(self.mode)
|
||||
local multipledaycount = userData and userData:GetMultipleDayCount() or 0
|
||||
if multipledaycount >= self.multipleDaylimit then
|
||||
return false
|
||||
end
|
||||
|
||||
if self.multipleAcclimit then
|
||||
local multipleacclimitcharid = userData and userData:GetMultipleAcclimitCharid() or 0
|
||||
if multipleacclimitcharid ~= 0 and multipleacclimitcharid ~= Game.Myself.data.id then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--翻倍獎勵
|
||||
function AERewardInfoData:GetMultiple()
|
||||
if self:CheckMultipleReward() then
|
||||
return self.multiple
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
--額外次數
|
||||
function AERewardInfoData:GetExtraTimes()
|
||||
return self.extratimes
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 062f5eba24af243dc84ff3de007fc4ca
|
||||
timeCreated: 1513312197
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,20 @@
|
||||
AERewardItemData = class("AERewardItemData")
|
||||
|
||||
function AERewardItemData:ctor(data)
|
||||
self:SetData(data)
|
||||
end
|
||||
|
||||
function AERewardItemData:SetData(data)
|
||||
if data ~= nil then
|
||||
self.multipledaycount = data.multipledaycount
|
||||
self.multipleacclimitcharid = data.multipleacclimitcharid
|
||||
end
|
||||
end
|
||||
|
||||
function AERewardItemData:GetMultipleDayCount()
|
||||
return self.multipledaycount
|
||||
end
|
||||
|
||||
function AERewardItemData:GetMultipleAcclimitCharid()
|
||||
return self.multipleacclimitcharid
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3cd2e99a2b6cb4f51a021f6ec9f84d62
|
||||
timeCreated: 1517405302
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Data/Adventure.meta
Normal file
10
Assets/Resources/Script/Com/Data/Adventure.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8505fb099e45149b5a100b467f4a3ca0
|
||||
folderAsset: yes
|
||||
timeCreated: 1449630833
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,115 @@
|
||||
AdventureAchieveBagData = class("AdventureAchieveBagData")
|
||||
autoImport("AdventureAchieveTab")
|
||||
autoImport("AdventureAchieveData")
|
||||
function AdventureAchieveBagData:ctor(tabClass,type)
|
||||
self.tabs = {}
|
||||
self.itemMapTab = {}
|
||||
self.type = type
|
||||
self.tableData = Table_Achievement[self.type]
|
||||
self.wholeTab = AdventureAchieveTab.new()
|
||||
self.wholeTab:setBagTypeData(self.type)
|
||||
self:initTabDatas()
|
||||
end
|
||||
|
||||
function AdventureAchieveBagData:initTabDatas( )
|
||||
-- body
|
||||
local categorys = AdventureAchieveProxy.Instance:getTabsByCategory(self.type)
|
||||
if(categorys and categorys.childs)then
|
||||
for k,v in pairs(categorys.childs) do
|
||||
local tabData = AdventureAchieveTab.new(v.staticData)
|
||||
self.tabs[k] = tabData
|
||||
for i=1,#v.types do
|
||||
self.itemMapTab[v.types[i].id] = tabData
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAchieveBagData:getTabByItemAndType( item )
|
||||
-- body
|
||||
return self.itemMapTab[item.staticData.id]
|
||||
end
|
||||
|
||||
function AdventureAchieveBagData:AddItems(items,tabType)
|
||||
if(tabType ~=nil) then
|
||||
local tab = self.tabs[tabType]
|
||||
if(tab ~=nil) then
|
||||
tab:AddItems(items)
|
||||
end
|
||||
end
|
||||
self.wholeTab:AddItems(items)
|
||||
end
|
||||
|
||||
function AdventureAchieveBagData:AddItem(item)
|
||||
local tab = self:getTabByItemAndType(item)
|
||||
if(tab ~=nil) then
|
||||
tab:AddItem(item)
|
||||
item.tabData = tab.tab
|
||||
end
|
||||
self.wholeTab:AddItem(item)
|
||||
end
|
||||
|
||||
function AdventureAchieveBagData:UpdateItems(manualData)
|
||||
local serverItems = manualData.items
|
||||
for i=1,#serverItems do
|
||||
local sItem = serverItems[i]
|
||||
-- print(sItem)
|
||||
local item = self:GetItemByStaticID(sItem.id)
|
||||
-- helplog("UpdateItems",sItem.id,sItem.process,sItem.finishtime)
|
||||
-- helplog("UpdateItems",#sItem.params)
|
||||
|
||||
if(item ~=nil) then
|
||||
self:UpdateItem(item,sItem)
|
||||
local tab = self:getTabByItemAndType(item)
|
||||
if(tab)then
|
||||
tab:SetDirty()
|
||||
end
|
||||
else
|
||||
item = AdventureAchieveData.new(sItem)
|
||||
if(item.staticData)then
|
||||
self:UpdateItem(item,sItem)
|
||||
if(item.staticData ~= nil) then
|
||||
local tab = self:getTabByItemAndType(item)
|
||||
self:AddItem(item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAchieveBagData:UpdateItem(item,serverItem)
|
||||
item = item or self:GetItemByStaticID(serverItem.id)
|
||||
if(item ~=nil) then
|
||||
item:updateServerData(serverItem)
|
||||
local tab = self:getTabByItemAndType(item)
|
||||
if(tab ~=nil) then
|
||||
tab:SetDirty(true)
|
||||
end
|
||||
self.wholeTab:SetDirty(true)
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAchieveBagData:GetTab(tabType)
|
||||
if(tabType ~=nil) then
|
||||
local tab = self.tabs[tabType]
|
||||
if(tab ~=nil) then
|
||||
return tab
|
||||
end
|
||||
end
|
||||
return self.wholeTab
|
||||
end
|
||||
|
||||
--tabtype 見gameconfig下的itempage和itemfashion
|
||||
function AdventureAchieveBagData:GetItems(tabType)
|
||||
if(tabType ~=nil) then
|
||||
local tab = self.tabs[tabType]
|
||||
if(tab ~=nil) then
|
||||
return tab:GetItems()
|
||||
end
|
||||
end
|
||||
return self.wholeTab:GetItems()
|
||||
end
|
||||
|
||||
function AdventureAchieveBagData:GetItemByStaticID(id)
|
||||
return self.wholeTab:GetItemByStaticID(id)
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7b42e983f79f4cf48f329b1939ad9d1
|
||||
timeCreated: 1493007764
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,67 @@
|
||||
AdventureAchieveData = class("AdventureAchieveData")
|
||||
|
||||
function AdventureAchieveData:ctor(serverData)
|
||||
self:updateServerData(serverData)
|
||||
self:initStaticData()
|
||||
end
|
||||
|
||||
function AdventureAchieveData:updateServerData( serverData )
|
||||
-- body
|
||||
self.id = serverData.id
|
||||
self.finishtime = serverData.finishtime
|
||||
self.process = serverData.process
|
||||
self.reward_get = serverData.reward_get
|
||||
self:updateQuests(serverData)
|
||||
self:initCompleteString()
|
||||
end
|
||||
|
||||
function AdventureAchieveData:updateQuests( serverData )
|
||||
local quests = serverData.quests
|
||||
if(quests and #quests>0)then
|
||||
self.questDatas = {}
|
||||
for i=1,#quests do
|
||||
local single = quests[i]
|
||||
local id = single.id
|
||||
local name = single.name
|
||||
local data = {id = id,name = name}
|
||||
local pre = single.pre
|
||||
if(pre and #pre>0)then
|
||||
local pres = {}
|
||||
for j=1, #pre do
|
||||
pres[#pres+1] = {id = pre[j].id,name = pre[j].name}
|
||||
end
|
||||
data.pre = pres
|
||||
end
|
||||
self.questDatas[#self.questDatas+1] = data
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAchieveData:initStaticData( )
|
||||
-- body
|
||||
self.staticData = Table_Achievement[self.id]
|
||||
end
|
||||
|
||||
function AdventureAchieveData:initCompleteString ( )
|
||||
-- body
|
||||
if self.finishtime and self.finishtime >0 then
|
||||
self.dateStr = os.date("%Y.%m.%d",self.finishtime)
|
||||
else
|
||||
self.dateStr = nil
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAchieveData:getCompleteString( )
|
||||
-- body
|
||||
return self.dateStr
|
||||
end
|
||||
|
||||
function AdventureAchieveData:getProcess( )
|
||||
-- body
|
||||
return self.process and self.process or 0
|
||||
end
|
||||
|
||||
function AdventureAchieveData:canGetReward( )
|
||||
-- body
|
||||
return self.dateStr and not self.reward_get or false
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 515da0745ffd8490c914206e63cf7434
|
||||
timeCreated: 1493018396
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,158 @@
|
||||
autoImport("ItemData")
|
||||
|
||||
AdventureAchieveTab = class("AdventureAchieveTab")
|
||||
|
||||
function AdventureAchieveTab:ctor(tab)
|
||||
self:Reset()
|
||||
self.tab = tab
|
||||
self.dirty = false
|
||||
self.itemsMap = {}
|
||||
if(self.tab)then
|
||||
self:setBagTypeData(tab.SubGroup)
|
||||
-- helplog("AdventureAchieveTab:redtip",tab.RedTip,tab.id,tab.Name)
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:setBagTypeData( type )
|
||||
-- body
|
||||
self.bagTypeData = Table_ItemTypeAdventureLog[type]
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:SetDirty(val)
|
||||
-- val = val or true
|
||||
self.dirty = val or true
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:AddItems(items)
|
||||
if(items ~=nil) then
|
||||
for i=1,#items do
|
||||
self:AddItem(items[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:AddItem(item)
|
||||
if(item ~=nil) then
|
||||
self.itemsMap[item.id] = item
|
||||
self.dirty = true
|
||||
-- table.insert(self.items,item)
|
||||
self.items[#self.items+1] = item
|
||||
-- print("index:"..item.staticId)
|
||||
-- print(#self.items)
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:RemoveItems(itemIds)
|
||||
-- body
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:GetItems()
|
||||
if(self.dirty==true) then
|
||||
self.parsedItems = {}
|
||||
local tempItems = {unpack(self.items)}
|
||||
for i=1,#tempItems do
|
||||
local single = tempItems[i]
|
||||
if(single.staticData.Visibility ~= 1 or single:getCompleteString())then
|
||||
self.parsedItems[#self.parsedItems +1] = single
|
||||
end
|
||||
end
|
||||
-- table.sort(self.items,self.sortFunc)
|
||||
-- printRed("table soft")
|
||||
table.sort(self.parsedItems,function(l,r)
|
||||
return self:sortFunc(l,r)
|
||||
end)
|
||||
self.dirty = false
|
||||
end
|
||||
return self.parsedItems
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:sortFunc(left,right)
|
||||
local lAdSort = left.staticData.AdventureSort
|
||||
local rAdSort = right.staticData.AdventureSort
|
||||
if(left:canGetReward() == right:canGetReward())then
|
||||
-- if(left:getCompleteString() == right:getCompleteString())then
|
||||
if(lAdSort == rAdSort)then
|
||||
return left.id < right.id
|
||||
else
|
||||
if(lAdSort == nil)then
|
||||
return false
|
||||
elseif rAdSort == nil then
|
||||
return true
|
||||
else
|
||||
return lAdSort < rAdSort
|
||||
end
|
||||
end
|
||||
-- else
|
||||
-- if(left:getCompleteString() == nil)then
|
||||
-- helplog("left:getCompleteString()",tostring(left:getCompleteString()))
|
||||
-- return false
|
||||
-- elseif(left:getCompleteString() ~= nil and right:getCompleteString()~=nil)then
|
||||
-- return left.finishtime > right.finishtime
|
||||
-- else
|
||||
-- return true
|
||||
-- end
|
||||
-- end
|
||||
else
|
||||
-- helplog("left:canGetReward()",tostring(left:canGetReward()))
|
||||
return left:canGetReward()
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:GetItemByStaticID(staticID)
|
||||
for _, o in pairs(self.items) do
|
||||
if o.staticData ~= nil and o.staticData.id == staticID then
|
||||
return o
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:GetItemNumByStaticID(staticID)
|
||||
local num = 0
|
||||
for _, o in pairs(self.items) do
|
||||
if o.staticData ~= nil and o.staticData.id == staticID then
|
||||
num = num + o.num
|
||||
-- return o
|
||||
end
|
||||
end
|
||||
return num
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:GetItemNumByStaticIDs(staticIDs)
|
||||
local numMap = {}
|
||||
for i=1,#staticIDs do
|
||||
numMap[staticIDs[i]] = 0
|
||||
end
|
||||
local num
|
||||
for _, o in pairs(self.items) do
|
||||
if o.staticData ~= nil then
|
||||
num = numMap[o.staticData.id]
|
||||
if(num~=nil) then
|
||||
num = num + o.num
|
||||
numMap[o.staticData.id] = num
|
||||
end
|
||||
end
|
||||
end
|
||||
return numMap
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:GetItemsByType(typeID,sortFunc)
|
||||
local res = {}
|
||||
for _, o in pairs(self.items) do
|
||||
if o.staticData ~= nil and o.staticData.Type == typeID then
|
||||
res[#res+1] = o
|
||||
end
|
||||
end
|
||||
if(sortFunc~=nil) then
|
||||
table.sort(res,function(l,r)
|
||||
return sortFunc(self,l,r)
|
||||
end)
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
function AdventureAchieveTab:Reset()
|
||||
self.items = {}
|
||||
self.itemsMap = {}
|
||||
self.parsedItems = {}
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 935a8d935450546d9add69a56d3be7dc
|
||||
timeCreated: 1493007764
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,200 @@
|
||||
AdventureAppendData = class("AdventureAppendData")
|
||||
|
||||
AdventureAppendData.RewardDataType = {
|
||||
empty = 1,
|
||||
normal = 2,
|
||||
special = 3,
|
||||
monstUnlock = 4,
|
||||
buffer = 5,
|
||||
}
|
||||
function AdventureAppendData:ctor(serverData)
|
||||
self.staticId = serverData.id
|
||||
self:initStaticData()
|
||||
self:updateData(serverData)
|
||||
end
|
||||
|
||||
function AdventureAppendData:updateData( serverData )
|
||||
-- body
|
||||
self.process = serverData.process
|
||||
self.finish = serverData.finish
|
||||
self.rewardget = serverData.rewardget
|
||||
end
|
||||
|
||||
function AdventureAppendData:initStaticData( )
|
||||
-- body
|
||||
self.staticData = Table_AdventureAppend[self.staticId]
|
||||
if(self.staticData)then
|
||||
self.appendName = self.staticData.NameZh
|
||||
local rewards = ItemUtil.GetRewardItemIdsByTeamId(self.staticData.Reward)
|
||||
if(not rewards)then
|
||||
LogUtility.WarningFormat("can't find reward in Table_Reward reward id:{0} by Table_AdventureAppend id :{1}",self.staticData.Reward,self.staticId)
|
||||
return
|
||||
end
|
||||
table.sort(rewards ,function ( l,r )
|
||||
-- body
|
||||
return l.id < r.id
|
||||
end)
|
||||
local specialList = {}
|
||||
self.rewardItemDatas = {}
|
||||
self.normalItemDatas = {}
|
||||
self.specialItemDatas = {}
|
||||
for i=1,#rewards do
|
||||
local single = rewards[i]
|
||||
local itemData = Table_Item[single.id]
|
||||
if(itemData)then
|
||||
local data = {}
|
||||
if(ItemUtil.CheckItemIsSpecialInAdventureAppend(itemData.Type))then
|
||||
data.type = AdventureAppendData.RewardDataType.special
|
||||
data.text = string.format(ZhString.AdventureAppendRewardPanel_Unlock,itemData.NameZh)
|
||||
table.insert(specialList,data)
|
||||
table.insert(self.specialItemDatas,single)
|
||||
else
|
||||
data.type = AdventureAppendData.RewardDataType.normal
|
||||
data.text = string.format("%sx%d",itemData.NameZh,single.num)
|
||||
data.icon = itemData.Icon
|
||||
table.insert(self.rewardItemDatas,data)
|
||||
table.insert(self.normalItemDatas,single)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if(#self.rewardItemDatas%2 ~= 0)then
|
||||
local data = {}
|
||||
data.type = AdventureAppendData.RewardDataType.empty
|
||||
table.insert(self.rewardItemDatas,data)
|
||||
end
|
||||
|
||||
for i=1,#specialList do
|
||||
local single = specialList[i]
|
||||
table.insert(self.rewardItemDatas,single)
|
||||
local data = {}
|
||||
data.type = AdventureAppendData.RewardDataType.empty
|
||||
table.insert(self.rewardItemDatas,data)
|
||||
end
|
||||
|
||||
if(self.staticData.BuffID)then
|
||||
local data = {}
|
||||
local str = ItemUtil.getBufferDescByIdNotConfigDes(self.staticData.BuffID) or "";
|
||||
data.text = string.format(ZhString.AdventureAppendRewardPanel_BufferUnlock,str)
|
||||
data.type = AdventureAppendData.RewardDataType.buffer
|
||||
table.insert(self.rewardItemDatas,data)
|
||||
|
||||
data = {}
|
||||
data.type = AdventureAppendData.RewardDataType.empty
|
||||
table.insert(self.rewardItemDatas,data)
|
||||
end
|
||||
|
||||
local isPhoto = self.staticData.Content == QuestDataStepType.QuestDataStepType_SELFIE
|
||||
local isMonster = self.staticData.Type == SceneManual_pb.EMANUALTYPE_MONSTER
|
||||
if( isPhoto and isMonster)then
|
||||
self.isMonstUnlock = true
|
||||
local data = {}
|
||||
data.type = AdventureAppendData.RewardDataType.monstUnlock
|
||||
data.text = ZhString.AdventureAppendRewardPanel_MonstUnlock
|
||||
table.insert(self.rewardItemDatas,data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAppendData:getNormalRewardItems( )
|
||||
-- body
|
||||
return self.normalItemDatas
|
||||
end
|
||||
|
||||
function AdventureAppendData:getSpecialRewardItems( )
|
||||
-- body
|
||||
return self.specialItemDatas
|
||||
end
|
||||
|
||||
function AdventureAppendData:isMonstUnlock( )
|
||||
-- body
|
||||
return self.isMonstUnlock
|
||||
end
|
||||
|
||||
function AdventureAppendData:isCompleted( )
|
||||
-- body
|
||||
return self.finish and not self.rewardget
|
||||
end
|
||||
|
||||
function AdventureAppendData:getRewardItems( )
|
||||
-- body
|
||||
return self.rewardItemDatas
|
||||
end
|
||||
|
||||
function AdventureAppendData:getAppendName( )
|
||||
-- body
|
||||
return self.appendName
|
||||
end
|
||||
|
||||
function AdventureAppendData:getProcessInfo( )
|
||||
-- body
|
||||
if(self.staticData)then
|
||||
self.traceInfo = self.staticData.Desc
|
||||
local tableValue = self:getTranceInfoTable()
|
||||
if(tableValue == nil)then
|
||||
return "parse table text is nil:"..self.traceInfo
|
||||
end
|
||||
local result = self.traceInfo and string.gsub(self.traceInfo,'%[(%w+)]',tableValue) or ''
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureAppendData:getTranceInfoTable( )
|
||||
-- body
|
||||
local table = {}
|
||||
local questType = self.staticData.Content
|
||||
if( questType == QuestDataStepType.QuestDataStepType_SELFIE)then
|
||||
local id = self.staticData.targetID
|
||||
local infoTable = Table_Monster[id]
|
||||
if(infoTable == nil)then
|
||||
infoTable = Table_Npc[id]
|
||||
end
|
||||
|
||||
if(infoTable ~= nil)then
|
||||
table = {
|
||||
param2 = nil,
|
||||
monsterName = infoTable.NameZh,
|
||||
}
|
||||
else
|
||||
errorLog("AdventureAppendData can't find mosntData in Table_Monster by targetID:",id)
|
||||
end
|
||||
|
||||
elseif(questType == QuestDataStepType.QuestDataStepType_KILL)then
|
||||
local process = self.process
|
||||
local id = self.staticData.targetID
|
||||
local totalNum = self.staticData.Params[1]
|
||||
local infoTable = Table_Monster[id]
|
||||
if(infoTable == nil)then
|
||||
infoTable = Table_Npc[id]
|
||||
end
|
||||
if(infoTable ~= nil)then
|
||||
table = {
|
||||
monsterName = infoTable.NameZh,
|
||||
num = string.format("[c][0077BBFF]%s[-][/c]",process..'/'..totalNum)
|
||||
}
|
||||
else
|
||||
print("AdventureAppendData can't find mosntData in Table_Monster by targetID:",id)
|
||||
end
|
||||
elseif(questType == "active")then
|
||||
local process = self.process
|
||||
local totalNum = self.staticData.Params[1]
|
||||
table = {
|
||||
num = string.format("[c][0077BBFF]%s[-][/c]",tostring(process)..'/'..tostring(totalNum))
|
||||
}
|
||||
|
||||
end
|
||||
return table
|
||||
end
|
||||
|
||||
-- function AdventureAppendData.getAppendData( type,staticId )
|
||||
-- -- body
|
||||
-- local list
|
||||
-- for k,v in pairs(Table_AdventureAppend) do
|
||||
-- if(v.Type == type and staticId == v.targetID)then
|
||||
-- local data = AdventureAppendData.new(v)
|
||||
-- list = list or {}
|
||||
-- table.insert(list,data)
|
||||
-- end
|
||||
-- end
|
||||
-- return list
|
||||
-- end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2aab385a016b14437ac94ba787bf2a99
|
||||
timeCreated: 1462870975
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,15 @@
|
||||
|
||||
AdventureAppendRewardItemData = class("AdventureAppendRewardItemData")
|
||||
|
||||
function AdventureAppendRewardItemData:ctor(id)
|
||||
|
||||
self:initStaticData()
|
||||
self:updateData(serverData)
|
||||
end
|
||||
|
||||
function AdventureAppendRewardItemData:updateData( serverData )
|
||||
-- body
|
||||
self.process = serverData.process
|
||||
self.finish = serverData.finish
|
||||
self.rewardget = serverData.rewardget
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1d1c48880812462ea784987164dbeda
|
||||
timeCreated: 1462957729
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
238
Assets/Resources/Script/Com/Data/Adventure/AdventureBagData.txt
Normal file
238
Assets/Resources/Script/Com/Data/Adventure/AdventureBagData.txt
Normal file
@ -0,0 +1,238 @@
|
||||
AdventureBagData = class("AdventureBagData")
|
||||
autoImport("AdventureTab")
|
||||
autoImport("AdventureItemData")
|
||||
autoImport("Table_AdventureValue")
|
||||
function AdventureBagData:ctor(tabClass,type)
|
||||
self.tabs = {}
|
||||
self.itemMapTab = {}
|
||||
self.type = type
|
||||
self.tableData = Table_ItemTypeAdventureLog[self.type]
|
||||
self.totalScore = 0
|
||||
self.totalCount = 0
|
||||
self.curUnlockCount = 0
|
||||
self.allScore = 0
|
||||
self.allCount = 0
|
||||
self.wholeTab = AdventureTab.new()
|
||||
self.wholeTab:setBagTypeData(self.type)
|
||||
self:initTabDatas()
|
||||
end
|
||||
|
||||
function AdventureBagData:initTabDatas( )
|
||||
-- body
|
||||
local categorys = AdventureDataProxy.Instance:getTabsByCategory(self.type)
|
||||
if(categorys and categorys.childs)then
|
||||
for k,v in pairs(categorys.childs) do
|
||||
local tabData = AdventureTab.new(v.staticData)
|
||||
self.tabs[k] = tabData
|
||||
for i=1,#v.types do
|
||||
self.itemMapTab[v.types[i]] = tabData
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if(self.type == SceneManual_pb.EMANUALTYPE_MONSTER)then
|
||||
-- self.allScore = Table_AdventureValue["monster"]
|
||||
self.allCount = Table_AdventureValue["monster"].monster.count
|
||||
self.allCount = self.allCount + Table_AdventureValue["monster"].mvp.count
|
||||
self.allCount = self.allCount + Table_AdventureValue["monster"].mini.count
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_PET)then
|
||||
-- self.allCount = Table_AdventureValue["monster"].petnpc.count
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_MAP)then
|
||||
-- self.allScore = Table_AdventureValue["map"]
|
||||
self.allCount = Table_AdventureValue["map"]
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_NPC)then
|
||||
-- self.allScore = Table_AdventureValue["NPC"]
|
||||
self.allCount = AdventureDataProxy.Instance.NpcCount
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_FASHION)then
|
||||
self.allCount = Table_AdventureValue["item"].fashionClothes.count
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_MOUNT)then
|
||||
-- self.allScore = Table_AdventureValue["item"][2]
|
||||
self.allCount = Table_AdventureValue["item"].ride.count
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_CARD)then
|
||||
self.allCount = Table_AdventureValue["item"].card.count
|
||||
-- self.allScore = Table_AdventureValue["item"][3]
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_SCENERY)then
|
||||
self.allCount = Table_AdventureValue["viewSpot"].count
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_COLLECTION)then
|
||||
self.allCount = Table_AdventureValue["monthlyVIP"].count
|
||||
end
|
||||
end
|
||||
|
||||
--items數據,tabtype標籤
|
||||
function AdventureBagData:AddItems(items,tabType)
|
||||
if(tabType ~=nil) then
|
||||
local tab = self.tabs[tabType]
|
||||
if(tab ~=nil) then
|
||||
tab:AddItems(items)
|
||||
end
|
||||
end
|
||||
self.wholeTab:AddItems(items)
|
||||
end
|
||||
|
||||
function AdventureBagData:getTabByItemAndType( item,type )
|
||||
-- body
|
||||
if(item == nil or not item.staticData)then
|
||||
return
|
||||
end
|
||||
local tab
|
||||
if(type == SceneManual_pb.EMANUALTYPE_NPC)then
|
||||
tab = self.itemMapTab[GameConfig.AdventureCategoryMonsterType.NPC]
|
||||
-- print("npc:"..GameConfig.AdventureCategoryMonsterType.NPC)
|
||||
elseif(type == SceneManual_pb.EMANUALTYPE_MONSTER or type == SceneManual_pb.EMANUALTYPE_PET)then
|
||||
tab = self.itemMapTab[GameConfig.AdventureCategoryMonsterType[item.staticData.Type]]
|
||||
-- print("monster:"..item.staticData.Type,GameConfig.AdventureCategoryMonsterType[item.staticData.Type])
|
||||
elseif(type == SceneManual_pb.EMANUALTYPE_ACHIEVE)then
|
||||
|
||||
elseif(type == SceneManual_pb.EMANUALTYPE_MAP)then
|
||||
elseif(type == SceneManual_pb.EMANUALTYPE_MATE)then
|
||||
tab = self.itemMapTab[GameConfig.AdventureCategoryMonsterType.MercenaryCat]
|
||||
elseif(type == SceneManual_pb.EMANUALTYPE_SCENERY)then
|
||||
local mapData = Table_Map[item.staticData.MapName]
|
||||
if(mapData)then
|
||||
tab = self.itemMapTab[mapData.Range]
|
||||
end
|
||||
else
|
||||
tab = self.itemMapTab[item.staticData.Type]
|
||||
-- print(tab)
|
||||
-- print(item.staticId)
|
||||
-- print(type)
|
||||
-- print("item:"..item.staticData.Type)
|
||||
end
|
||||
if(not tab)then
|
||||
-- printRed("tab is nil id:")
|
||||
-- print(item.staticId)
|
||||
-- print(type)
|
||||
-- print("item type:")
|
||||
-- print(item.staticData.Type)
|
||||
end
|
||||
return tab
|
||||
end
|
||||
|
||||
|
||||
function AdventureBagData:AddItem(item,type)
|
||||
local tab = self:getTabByItemAndType(item,type)
|
||||
if(tab ~=nil) then
|
||||
tab:AddItem(item)
|
||||
item.tabData = tab.tab
|
||||
tab.totalCount = tab.totalCount + 1
|
||||
end
|
||||
self.wholeTab:AddItem(item)
|
||||
if(type == SceneManual_pb.EMANUALTYPE_MAP)then
|
||||
AdventureDataProxy.Instance:NewMapAdd(item.staticId)
|
||||
end
|
||||
if(item.status ~= SceneManual_pb.EMANUALSTATUS_DISPLAY and item.status ~=SceneManual_pb.EMANUALSTATUS_UNLOCK_CLIENT)then
|
||||
self.totalScore = self.totalScore + item.AdventureValue
|
||||
self.curUnlockCount = self.curUnlockCount + 1
|
||||
if(tab ~=nil) then
|
||||
tab.curUnlockCount = tab.curUnlockCount + 1
|
||||
tab.totalScore = tab.totalScore + item.AdventureValue
|
||||
end
|
||||
end
|
||||
self.totalCount = self.totalCount+1
|
||||
end
|
||||
|
||||
function AdventureBagData:UpdateItems(manualData,type)
|
||||
local serverItems = manualData.items
|
||||
-- printRed("UpdateItems:")
|
||||
-- printRed(#serverItems)
|
||||
-- print(type)
|
||||
local updateSceneIds = {}
|
||||
for i=1,#serverItems do
|
||||
local sItem = serverItems[i]
|
||||
-- print(sItem)
|
||||
local item = self:GetItemByStaticID(sItem.id)
|
||||
if(item ~=nil) then
|
||||
local oldStatus = item.status
|
||||
self:UpdateItem(item,sItem)
|
||||
local tab = self:getTabByItemAndType(item,type)
|
||||
if(tab)then
|
||||
tab:SetDirty()
|
||||
end
|
||||
if(oldStatus == SceneManual_pb.EMANUALSTATUS_UNLOCK_CLIENT and item.status ~= SceneManual_pb.EMANUALSTATUS_UNLOCK_CLIENT )then
|
||||
self.totalScore = self.totalScore + item.AdventureValue
|
||||
self.curUnlockCount = self.curUnlockCount + 1
|
||||
if(tab)then
|
||||
tab.curUnlockCount = tab.curUnlockCount + 1
|
||||
tab.totalScore = tab.totalScore + item.AdventureValue
|
||||
end
|
||||
end
|
||||
|
||||
if(type == SceneManual_pb.EMANUALTYPE_SCENERY)then
|
||||
if(oldStatus == SceneManual_pb.EMANUALSTATUS_DISPLAY and
|
||||
item.staticData.Type == 1 and
|
||||
(item.status ~= SceneManual_pb.EMANUALSTATUS_DISPLAY))then
|
||||
table.insert(updateSceneIds,item.staticId)
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
item = AdventureItemData.new(sItem,type)
|
||||
self:UpdateItem(item,sItem)
|
||||
if(item.staticData ~=nil) then
|
||||
self:AddItem(item,type)
|
||||
else
|
||||
-- self.wholeTab:ResetPlaceHolder(sItemData)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if(#updateSceneIds > 0)then
|
||||
GameFacade.Instance:sendNotification(AdventureDataEvent.SceneItemsUpdate, updateSceneIds)
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureBagData:UpdateItem(item,serverItem)
|
||||
item = item or self:GetItemByStaticID(serverItem.id)
|
||||
if(item ~=nil) then
|
||||
item:updateManualData(serverItem)
|
||||
self.wholeTab:SetDirty(true)
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureBagData:Reset()
|
||||
self.wholeTab:Reset()
|
||||
for k,v in pairs(self.tabs) do
|
||||
v:Reset()
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureBagData:GetTab(tabType)
|
||||
if(tabType ~=nil) then
|
||||
local tab = self.tabs[tabType]
|
||||
if(tab ~=nil) then
|
||||
return tab
|
||||
end
|
||||
end
|
||||
return self.wholeTab
|
||||
end
|
||||
|
||||
--tabtype 見gameconfig下的itempage和itemfashion
|
||||
function AdventureBagData:GetItems(tabType)
|
||||
if(tabType ~=nil) then
|
||||
local tab = self.tabs[tabType]
|
||||
if(tab ~=nil) then
|
||||
return tab:GetItems()
|
||||
end
|
||||
end
|
||||
return self.wholeTab:GetItems()
|
||||
end
|
||||
|
||||
function AdventureBagData:GetItemByStaticID(id)
|
||||
return self.wholeTab:GetItemByStaticID(id)
|
||||
end
|
||||
|
||||
function AdventureBagData:GetUnlockNum()
|
||||
local items = self:GetItems()
|
||||
local count = 0
|
||||
if(items and #items>0)then
|
||||
for i=1,#items do
|
||||
local item = items[i]
|
||||
if(item.status ~= SceneManual_pb.EMANUALSTATUS_DISPLAY and item.status ~=SceneManual_pb.EMANUALSTATUS_UNLOCK_CLIENT)then
|
||||
count = count +1
|
||||
end
|
||||
end
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
-- return Prop
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdb4ba8071a2641569339eb0106fe7f1
|
||||
timeCreated: 1462870112
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,96 @@
|
||||
autoImport("AdventureItemData")
|
||||
AdventureCollectionGroupData = class("AdventureCollectionGroupData",AdventureItemData)
|
||||
|
||||
function AdventureCollectionGroupData:ctor(staticId)
|
||||
self.staticId = staticId
|
||||
self:initData()
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:initData( )
|
||||
self.collections = {}
|
||||
self.isUnlock = false
|
||||
self:initStaticData()
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:setIsSelected( isSelected )
|
||||
-- body
|
||||
if(self.isSelected ~= isSelected)then
|
||||
self.isSelected = isSelected
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:initStaticData()
|
||||
self.staticData = Table_Collection[self.staticId]
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:addCollectionData(adventureData)
|
||||
if(adventureData.IsValid and adventureData:IsValid())then
|
||||
self.collections[#self.collections+1] = adventureData
|
||||
end
|
||||
end
|
||||
|
||||
local temp = {}
|
||||
function AdventureCollectionGroupData:getCollectionData()
|
||||
TableUtility.ArrayClear(temp)
|
||||
for i=1,#self.collections do
|
||||
local single = self.collections[i]
|
||||
if(single.IsValid and single:IsValid())then
|
||||
temp[#temp+1] = single
|
||||
end
|
||||
end
|
||||
return temp
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:hasToBeUnlockItem( )
|
||||
if(self.staticData.RedTip and not self:isTotalComplete() and not self:isTotalUnComplete())then
|
||||
if(self.collections and #self.collections>0)then
|
||||
for j=1,#self.collections do
|
||||
local singleColl = self.collections[j]
|
||||
if(singleColl.status == SceneManual_pb.EMANUALSTATUS_UNLOCK_CLIENT)then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:getCurrentUnlockNum( )
|
||||
local count = 0
|
||||
for i=1,#self.collections do
|
||||
local single = self.collections[i]
|
||||
if(single.status == SceneManual_pb.EMANUALSTATUS_UNLOCK)then
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:isTotalUnComplete( )
|
||||
for i=1,#self.collections do
|
||||
local single = self.collections[i]
|
||||
if(single.status ~= SceneManual_pb.EMANUALSTATUS_DISPLAY)then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:IsUnlock( )
|
||||
return self.isUnlock
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:setUnlock( unlock )
|
||||
self.isUnlock = unlock
|
||||
end
|
||||
|
||||
function AdventureCollectionGroupData:isTotalComplete( )
|
||||
-- body
|
||||
for i=1,#self.collections do
|
||||
local single = self.collections[i]
|
||||
if(single.status ~= SceneManual_pb.EMANUALSTATUS_UNLOCK)then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c281fbdb8d99242c2bb5bd9413c5fc63
|
||||
timeCreated: 1509505981
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
332
Assets/Resources/Script/Com/Data/Adventure/AdventureItemData.txt
Normal file
332
Assets/Resources/Script/Com/Data/Adventure/AdventureItemData.txt
Normal file
@ -0,0 +1,332 @@
|
||||
autoImport("EquipInfo")
|
||||
autoImport("SuitInfo")
|
||||
autoImport("AdventureAppendData")
|
||||
AdventureItemData = class("AdventureItemData")
|
||||
|
||||
function AdventureItemData:ctor(serverData,type)
|
||||
--動態唯一標識id
|
||||
self.type = type
|
||||
self.cardSlotNum = 0
|
||||
self.num = 0
|
||||
self.tabData = nil
|
||||
self.staticId = serverData.id
|
||||
self:updateManualData(serverData)
|
||||
self:initStaticData(self.staticId,serverData)
|
||||
end
|
||||
|
||||
function AdventureItemData:test( )
|
||||
-- body
|
||||
if(#self.setAppendDatas>0)then
|
||||
self.status = SceneManual_pb.EMANUALSTATUS_UNLOCK_STEP
|
||||
for i=1,#self.setAppendDatas do
|
||||
local single = self.setAppendDatas [i]
|
||||
single.finish = true
|
||||
single.rewardget = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureItemData:GetFoodSData( )
|
||||
|
||||
end
|
||||
|
||||
function AdventureItemData:IsLimitUse( )
|
||||
return false
|
||||
end
|
||||
|
||||
function AdventureItemData:isCollectionGroup( )
|
||||
if(self.type == nil)then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureItemData:canBeClick( )
|
||||
-- body
|
||||
local bRet = self.status == SceneManual_pb.EMANUALSTATUS_UNLOCK_CLIENT
|
||||
local cps = self:getCompleteNoRewardAppend()
|
||||
if(cps and #cps>0)then
|
||||
bRet = true
|
||||
end
|
||||
return bRet
|
||||
end
|
||||
|
||||
function AdventureItemData:updateManualData( serverData )
|
||||
-- body
|
||||
self.status = serverData.status
|
||||
self.attrUnlock = serverData.unlock
|
||||
self.store = serverData.store
|
||||
if(serverData.data_params and self.type == SceneManual_pb.EMANUALTYPE_SCENERY)then
|
||||
self:updateSceneData(serverData.data_params)
|
||||
end
|
||||
|
||||
if(serverData.quests)then
|
||||
self:updateAppendData(serverData.quests)
|
||||
end
|
||||
|
||||
local item = serverData.item
|
||||
if(item and self.equipInfo)then
|
||||
self.equipInfo:SetStrengthRefine(item.equip.strengthlv,item.equip.refinelv)
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureItemData:updateSceneData( params )
|
||||
-- body
|
||||
self.anglez = params[1] or 0
|
||||
self.anglez = tonumber(self.anglez)
|
||||
self.time = params[2] or 0
|
||||
self.time = tonumber(self.time)
|
||||
self.roleId = params[3]
|
||||
if not self.oldRoleId then
|
||||
self.oldRoleId = self.roleId
|
||||
end
|
||||
if(self.roleId)then
|
||||
self.roleId = tonumber(self.roleId)
|
||||
end
|
||||
|
||||
if(self.oldRoleId)then
|
||||
self.oldRoleId = tonumber(self.oldRoleId)
|
||||
end
|
||||
MySceneryPictureManager.Instance():log("updateSceneData:",self.staticId,tostring(self.roleId),tostring(self.time),self.anglez,self.oldRoleId)
|
||||
end
|
||||
|
||||
function AdventureItemData:updateAppendData( appends )
|
||||
-- body
|
||||
self.setAppendDatas = self.setAppendDatas or {}
|
||||
-- printRed("updateAppendData",#appends)
|
||||
for i=1,#appends do
|
||||
local single = appends[i]
|
||||
-- printRed(single.rewardget)
|
||||
-- printRed(single.process)
|
||||
-- printRed(single.finish)
|
||||
local appData = self:getAppendDataById(single.id)
|
||||
if(appData)then
|
||||
appData:updateData(single)
|
||||
else
|
||||
appData = AdventureAppendData.new(single)
|
||||
table.insert(self.setAppendDatas,appData)
|
||||
end
|
||||
end
|
||||
table.sort(self.setAppendDatas,function ( l,r )
|
||||
-- body
|
||||
return l.staticId < r.staticId
|
||||
end)
|
||||
end
|
||||
|
||||
function AdventureItemData:GetFoodSData( )
|
||||
|
||||
end
|
||||
|
||||
function AdventureItemData:getAppendDataById( appendId )
|
||||
-- body
|
||||
if(self.setAppendDatas)then
|
||||
for i=1,#self.setAppendDatas do
|
||||
local single = self.setAppendDatas[i]
|
||||
if(single.staticId == appendId)then
|
||||
return single
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureItemData:setIsSelected( isSelected )
|
||||
-- body
|
||||
if(self.isSelected ~= isSelected)then
|
||||
self.isSelected = isSelected
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureItemData:initStaticData(staticId,serverData)
|
||||
self.staticId = staticId
|
||||
if(self.type == SceneManual_pb.EMANUALTYPE_NPC)then
|
||||
self.staticData = Table_Npc[staticId]
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_MONSTER or self.type == SceneManual_pb.EMANUALTYPE_MATE or self.type == SceneManual_pb.EMANUALTYPE_PET)then
|
||||
self.staticData = Table_Monster[staticId]
|
||||
-- printRed("initStaticData:self.status",self.status,self.staticData.NameZh)
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_MAP)then
|
||||
self.staticData = Table_Map[staticId]
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_ACHIEVE)then
|
||||
self.staticData = Table_Achievement[staticId]
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_SCENERY)then
|
||||
self.staticData = Table_Viewspot[staticId]
|
||||
-- printRed("AdventureItemData:ResetData(staticId)")
|
||||
-- printRed(staticId)
|
||||
else
|
||||
self.staticData = Table_Item[staticId]
|
||||
local equipData = Table_Equip[staticId]
|
||||
if(equipData~=nil) then
|
||||
self.equipInfo = EquipInfo.new(equipData)
|
||||
local item = serverData.item
|
||||
if(item)then
|
||||
-- helplog("item.equip.strengthlv",item.equip.strengthlv,item.equip.refinelv)
|
||||
self.equipInfo:SetStrengthRefine(item.equip.strengthlv,item.equip.refinelv)
|
||||
end
|
||||
else
|
||||
self.equipInfo = nil
|
||||
end
|
||||
self.cardInfo = Table_Card[staticId]
|
||||
-- init suit
|
||||
if(self.equipInfo)then
|
||||
local suitId = self.equipInfo.equipData.SuitID;
|
||||
local suitSData = Table_EquipSuit[suitId];
|
||||
if(suitSData)then
|
||||
self.suitInfo = SuitInfo.new(suitId);
|
||||
end
|
||||
end
|
||||
self.monthCardInfo = Table_MonthCard[staticId]
|
||||
end
|
||||
if(self.staticData and self.staticData.AdventureValue and self.staticData.AdventureValue > 0)then
|
||||
self.AdventureValue = self.staticData.AdventureValue
|
||||
else
|
||||
self.AdventureValue = 0
|
||||
end
|
||||
-- self.setAppendDatas = AdventureAppendData.getAppendData(self.type,self.staticId)
|
||||
end
|
||||
|
||||
function AdventureItemData:CanEquip( )
|
||||
return false
|
||||
end
|
||||
|
||||
function AdventureItemData:getAdventureValue( )
|
||||
-- body
|
||||
return self.AdventureValue
|
||||
end
|
||||
|
||||
function AdventureItemData:GetName()
|
||||
if(self.staticData) then
|
||||
-- if(self.equipInfo and self.equipInfo.refinelv>0) then
|
||||
-- return "+"..self.equipInfo.refinelv..self.staticData.NameZh
|
||||
-- else
|
||||
if(self.type == SceneManual_pb.EMANUALTYPE_SCENERY)then
|
||||
return self.staticData.SpotName
|
||||
elseif(self.type == SceneManual_pb.EMANUALTYPE_CARD)then
|
||||
-- local str = self.staticData.NameZh
|
||||
-- str = string.gsub(str,"^"..ZhString.AdventureHomePage_CardName,"")
|
||||
return ZhString.AdventureHomePage_CardName
|
||||
end
|
||||
return self.staticData.NameZh
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function AdventureItemData:IsEquip()
|
||||
return self.equipInfo~=nil
|
||||
end
|
||||
|
||||
function AdventureItemData:IsFashion()
|
||||
if(self.staticData and self.staticData.Type)then
|
||||
return BagProxy.fashionType[self.staticData.Type];
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureItemData:IsMount()
|
||||
return self.staticData.Type==90;
|
||||
end
|
||||
|
||||
function AdventureItemData:IsNew()
|
||||
return self.isNew or false
|
||||
end
|
||||
|
||||
function AdventureItemData:Clone()
|
||||
local item = ItemData.new(self.id,self.staticData and self.staticData.id or 0)
|
||||
if(item.equipInfo) then
|
||||
item.equipInfo:Clone(self.equipInfo)
|
||||
end
|
||||
return item
|
||||
end
|
||||
|
||||
function AdventureItemData:getCompleteNoRewardAppend( )
|
||||
-- body
|
||||
local list = {}
|
||||
if(self.setAppendDatas)then
|
||||
for i=1,#self.setAppendDatas do
|
||||
local single = self.setAppendDatas [i]
|
||||
-- printRed("single.finish",single.finish)
|
||||
if(single.finish and not single.rewardget)then
|
||||
table.insert(list,single)
|
||||
end
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
function AdventureItemData:getNoRewardAppend( )
|
||||
-- body
|
||||
local list = {}
|
||||
if(self.setAppendDatas)then
|
||||
for i=1,#self.setAppendDatas do
|
||||
local single = self.setAppendDatas [i]
|
||||
if(not single.rewardget)then
|
||||
table.insert(list,single)
|
||||
end
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
function AdventureItemData:getAppendDatas( )
|
||||
-- body
|
||||
return self.setAppendDatas
|
||||
end
|
||||
|
||||
function AdventureItemData:getCatId( )
|
||||
-- body
|
||||
return self.CatId
|
||||
end
|
||||
|
||||
function AdventureItemData:setCatId( CatId )
|
||||
-- body
|
||||
self.CatId = CatId
|
||||
end
|
||||
|
||||
function AdventureItemData:IsValid( )
|
||||
return AdventureItemData.CheckValid(self.staticData )
|
||||
end
|
||||
|
||||
function AdventureItemData.CheckValid( staticData )
|
||||
if(not staticData )then
|
||||
return true
|
||||
end
|
||||
|
||||
if(StringUtil.IsEmpty(staticData.ValidDate) and StringUtil.IsEmpty(staticData.TFValidDate))then
|
||||
return true
|
||||
end
|
||||
|
||||
local validDate
|
||||
if(EnvChannel.IsReleaseBranch())then
|
||||
validDate = staticData.ValidDate
|
||||
elseif(EnvChannel.IsTFBranch())then
|
||||
validDate = staticData.TFValidDate
|
||||
end
|
||||
if(not StringUtil.IsEmpty(validDate) and ServerTime.CurServerTime())then
|
||||
local p ="(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)"
|
||||
local year,month,day,hour,min,sec = validDate:match(p)
|
||||
local ddd = tonumber(os.date("%z", 0))/100
|
||||
local offset = (8 - ddd)*3600
|
||||
local startDate = os.time({day=day,month=month,year=year,hour=hour,min=min,sec=sec})
|
||||
startDate = startDate - offset
|
||||
local server = ServerTime.CurServerTime()/1000
|
||||
if(server<startDate)then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function AdventureItemData:setCollectionGroupId( groupId )
|
||||
-- body
|
||||
self.collectionGroupId = groupId
|
||||
end
|
||||
|
||||
function AdventureItemData:getCollectionGroupId( )
|
||||
-- body
|
||||
return self.collectionGroupId
|
||||
end
|
||||
|
||||
function AdventureItemData:CompareTo(item)
|
||||
if(item) then
|
||||
-- print(string.format("%s戰鬥力%s,vs,%s戰鬥力%s",self.staticData.NameZh,self.battlepoint,item.staticData.NameZh,item.battlepoint))
|
||||
return self.battlepoint - item.battlepoint
|
||||
end
|
||||
return self.battlepoint
|
||||
end
|
||||
-- return Prop
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 810e3afd4b03c425b9e6765faa05afb7
|
||||
timeCreated: 1462870112
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
183
Assets/Resources/Script/Com/Data/Adventure/AdventureTab.txt
Normal file
183
Assets/Resources/Script/Com/Data/Adventure/AdventureTab.txt
Normal file
@ -0,0 +1,183 @@
|
||||
autoImport("ItemData")
|
||||
|
||||
AdventureTab = class("AdventureTab")
|
||||
|
||||
function AdventureTab:ctor(tab)
|
||||
self:Reset()
|
||||
self.tab = tab
|
||||
self.dirty = false
|
||||
self.totalScore = 0
|
||||
self.totalCount = 0
|
||||
self.curUnlockCount = 0
|
||||
if(self.tab)then
|
||||
self:setBagTypeData(tab.type)
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureTab:setBagTypeData( type )
|
||||
-- body
|
||||
self.bagTypeData = Table_ItemTypeAdventureLog[type]
|
||||
end
|
||||
|
||||
function AdventureTab:SetDirty(val)
|
||||
-- val = val or true
|
||||
self.dirty = val or true
|
||||
end
|
||||
|
||||
function AdventureTab:AddItems(items)
|
||||
if(items ~=nil) then
|
||||
for i=1,#items do
|
||||
self:AddItem(items[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureTab:AddItem(item)
|
||||
if(item ~=nil) then
|
||||
self.itemsMap[item.staticId] = item
|
||||
self.dirty = true
|
||||
-- table.insert(self.items,item)
|
||||
self.items[#self.items+1] = item
|
||||
-- print("index:"..item.staticId)
|
||||
-- print(#self.items)
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureTab:RemoveItems(itemIds)
|
||||
-- body
|
||||
end
|
||||
|
||||
function AdventureTab:GetItems()
|
||||
-- if(self.dirty==true) then
|
||||
self.parsedItems = {}
|
||||
for i=1,#self.items do
|
||||
local single = self.items[i]
|
||||
if(single:IsValid())then
|
||||
self.parsedItems[#self.parsedItems+1] = single
|
||||
end
|
||||
end
|
||||
table.sort(self.parsedItems,function(l,r)
|
||||
return self:sortFunc(l,r)
|
||||
end)
|
||||
-- self.dirty = false
|
||||
-- end
|
||||
return self.parsedItems
|
||||
end
|
||||
|
||||
function AdventureTab:sortFunc(left,right)
|
||||
-- if(left.status == right.status)then
|
||||
-- if(self.tab == nil)then -- 所有排序
|
||||
-- local lTabData = left.tabData
|
||||
-- local rTabData = right.tabData
|
||||
-- if(lTabData and rTabData)then
|
||||
-- local lTabOrder = left.tabData.Order
|
||||
-- local rTabOrder = right.tabData.Order
|
||||
-- if(lTabOrder == rTabOrder)then
|
||||
-- local lQuality = left.staticData.Quality
|
||||
-- local rQuality = right.staticData.Quality
|
||||
-- if(lQuality)then
|
||||
-- if(lQuality == rQuality)then
|
||||
-- return left.staticId < right.staticId
|
||||
-- else
|
||||
-- return lQuality > rQuality
|
||||
-- end
|
||||
-- else
|
||||
-- return left.staticId < right.staticId
|
||||
-- end
|
||||
-- else
|
||||
-- return lTabOrder < rTabOrder
|
||||
-- end
|
||||
-- else
|
||||
-- -- printRed("tabdatais nil ")
|
||||
-- return false
|
||||
-- end
|
||||
-- else --tab 內部排序
|
||||
-- local lQuality = left.staticData.Quality
|
||||
-- local rQuality = right.staticData.Quality
|
||||
-- if(lQuality)then
|
||||
-- if(lQuality == rQuality)then
|
||||
-- return left.staticId < right.staticId
|
||||
-- else
|
||||
-- return lQuality > rQuality
|
||||
-- end
|
||||
-- else
|
||||
-- return left.staticId < right.staticId
|
||||
-- end
|
||||
-- end
|
||||
-- else
|
||||
-- return left.status > right.status
|
||||
-- end
|
||||
local lAdSort = left.staticData.AdventureSort
|
||||
local rAdSort = right.staticData.AdventureSort
|
||||
if(lAdSort == rAdSort)then
|
||||
return left.staticId < right.staticId
|
||||
else
|
||||
if(lAdSort == nil)then
|
||||
return false
|
||||
elseif rAdSort == nil then
|
||||
return true
|
||||
else
|
||||
return lAdSort < rAdSort
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AdventureTab:GetItemByStaticID(staticID)
|
||||
for _, o in pairs(self.items) do
|
||||
if o.staticData ~= nil and o.staticData.id == staticID and o:IsValid() then
|
||||
return o
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function AdventureTab:GetItemNumByStaticID(staticID)
|
||||
local num = 0
|
||||
for _, o in pairs(self.items) do
|
||||
if o.staticData ~= nil and o.staticData.id == staticID and o:IsValid() then
|
||||
num = num + o.num
|
||||
-- return o
|
||||
end
|
||||
end
|
||||
return num
|
||||
end
|
||||
|
||||
function AdventureTab:GetItemNumByStaticIDs(staticIDs)
|
||||
local numMap = {}
|
||||
for i=1,#staticIDs do
|
||||
numMap[staticIDs[i]] = 0
|
||||
end
|
||||
local num
|
||||
for _, o in pairs(self.items) do
|
||||
if o.staticData ~= nil and o:IsValid() then
|
||||
num = numMap[o.staticData.id]
|
||||
if(num~=nil) then
|
||||
num = num + o.num
|
||||
numMap[o.staticData.id] = num
|
||||
end
|
||||
end
|
||||
end
|
||||
return numMap
|
||||
end
|
||||
|
||||
function AdventureTab:GetItemsByType(typeID,sortFunc)
|
||||
local res = {}
|
||||
for _, o in pairs(self.items) do
|
||||
if o.staticData ~= nil and o.staticData.Type == typeID and o:IsValid() then
|
||||
res[#res+1] = o
|
||||
end
|
||||
end
|
||||
if(sortFunc~=nil) then
|
||||
table.sort(res,function(l,r)
|
||||
return sortFunc(self,l,r)
|
||||
end)
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
function AdventureTab:Reset()
|
||||
self.items = {}
|
||||
self.itemsMap = {}
|
||||
self.parsedItems = {}
|
||||
end
|
||||
-- return Prop
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a83027cf9a3e546e48f571b6f12f9674
|
||||
timeCreated: 1462870112
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
70
Assets/Resources/Script/Com/Data/Adventure/PhotoData.txt
Normal file
70
Assets/Resources/Script/Com/Data/Adventure/PhotoData.txt
Normal file
@ -0,0 +1,70 @@
|
||||
PhotoData = class("PhotoData")
|
||||
|
||||
function PhotoData:ctor(serverData,type)
|
||||
--動態唯一標識id
|
||||
if(type == PhotoDataProxy.PhotoType.PersonalPhotoType)then
|
||||
self:updatePersonalPhoto(serverData)
|
||||
elseif(type == PhotoDataProxy.PhotoType.SceneryPhotoType)then
|
||||
self:updateMySceneryPhoto(serverData)
|
||||
else
|
||||
self:updateWallPhoto(serverData)
|
||||
end
|
||||
self.type = type
|
||||
end
|
||||
|
||||
function PhotoData:setBelongAcc(b )
|
||||
self.isBelongAccPic = b
|
||||
end
|
||||
|
||||
function PhotoData:isBelongAcc()
|
||||
return self.isBelongAccPic
|
||||
end
|
||||
|
||||
function PhotoData:updateMySceneryPhoto(adventureData )
|
||||
self.index = adventureData.staticId
|
||||
self.roleId = adventureData.roleId
|
||||
self.charid = self.roleId
|
||||
self.time = adventureData.time or 0
|
||||
self.anglez = adventureData.anglez or 0
|
||||
self.sourceid = self.index
|
||||
self.source = ProtoCommon_pb.ESOURCE_PHOTO_SCENERY
|
||||
self.isMyself = true
|
||||
end
|
||||
|
||||
function PhotoData:updateWallPhoto(serverData )
|
||||
self.index = serverData.index
|
||||
self.mapid = serverData.mapid
|
||||
self.time = serverData.time
|
||||
self.anglez = serverData.anglez
|
||||
self.charid = serverData.charid
|
||||
if(self.charid == Game.Myself.data.id)then
|
||||
self.isMyself = true
|
||||
end
|
||||
self.sourceid = serverData.sourceid
|
||||
self.source = serverData.source
|
||||
if(serverData.accid and serverData.accid ~= 0)then
|
||||
self.charid = serverData.accid
|
||||
|
||||
local loginData = FunctionLogin.Me():getLoginData()
|
||||
local account = loginData ~= nil and loginData.accid or 0
|
||||
|
||||
if(self.charid == account)then
|
||||
self.isMyself = true
|
||||
end
|
||||
self.isBelongAccPic = true
|
||||
else
|
||||
self.isBelongAccPic = false
|
||||
end
|
||||
end
|
||||
|
||||
function PhotoData:updatePersonalPhoto( serverData )
|
||||
-- body
|
||||
self.index = serverData.index
|
||||
self.mapid = serverData.mapid
|
||||
self.time = serverData.time
|
||||
self.isupload = serverData.isupload
|
||||
self.anglez = serverData.anglez
|
||||
self.sourceid = self.index
|
||||
self.source = ProtoCommon_pb.ESOURCE_PHOTO_SELF
|
||||
self.charid = serverData.charid
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f22fca6a2da894259a57aec34c739efb
|
||||
timeCreated: 1499864136
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Data/AdventureSkill.meta
Normal file
10
Assets/Resources/Script/Com/Data/AdventureSkill.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78a65572c290f4eef99e707c49edb658
|
||||
folderAsset: yes
|
||||
timeCreated: 1462346423
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,148 @@
|
||||
UIModelAdventureSkill = class("UIModelAdventureSkill")
|
||||
|
||||
local gReusableArray = {}
|
||||
|
||||
function UIModelAdventureSkill:ctor()
|
||||
|
||||
end
|
||||
|
||||
function UIModelAdventureSkill.Instance()
|
||||
if UIModelAdventureSkill.instance == nil then
|
||||
UIModelAdventureSkill.instance = UIModelAdventureSkill.new()
|
||||
end
|
||||
return UIModelAdventureSkill.instance
|
||||
end
|
||||
|
||||
local tabSkillShopItemsHaveNotLearn = {}
|
||||
local tabSkillShopItemsDataHaveNotLearn = {}
|
||||
|
||||
function UIModelAdventureSkill:GetSkillShopItemsHaveNotLearn()
|
||||
return tabSkillShopItemsHaveNotLearn
|
||||
end
|
||||
|
||||
function UIModelAdventureSkill:PadTabSkillShopItemsHaveNotLearn(tab_skills_have_not_learn)
|
||||
if tab_skills_have_not_learn ~= nil then
|
||||
for i = 1, #tab_skills_have_not_learn do
|
||||
local skillShopItemID = tab_skills_have_not_learn[i]
|
||||
if not table.ContainsValue(tabSkillShopItemsHaveNotLearn, skillShopItemID) then
|
||||
table.insert(tabSkillShopItemsHaveNotLearn, skillShopItemID)
|
||||
local skillShopItemData = ShopProxy.Instance:GetShopItemDataByTypeId(
|
||||
FuncAdventureSkill.iShopType,
|
||||
FuncAdventureSkill.Instance().iSerialNumber,
|
||||
skillShopItemID
|
||||
)
|
||||
table.insert(tabSkillShopItemsDataHaveNotLearn, skillShopItemData)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UIModelAdventureSkill:RemoveFromTabSkillShopItemsHaveNotLearn(i_skill_shop_item_id)
|
||||
for i = #tabSkillShopItemsHaveNotLearn, 1, -1 do
|
||||
local skillShopItemID = tabSkillShopItemsHaveNotLearn[i]
|
||||
if skillShopItemID == i_skill_shop_item_id then
|
||||
table.remove(tabSkillShopItemsHaveNotLearn, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
for i = #tabSkillShopItemsDataHaveNotLearn, 1, -1 do
|
||||
local skillShopItemData = tabSkillShopItemsDataHaveNotLearn[i]
|
||||
if skillShopItemData.id == i_skill_shop_item_id then
|
||||
table.remove(tabSkillShopItemsDataHaveNotLearn, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UIModelAdventureSkill:ClearTabSkillShopItemsHaveNotLearn()
|
||||
TableUtility.ArrayClear(tabSkillShopItemsHaveNotLearn)
|
||||
TableUtility.ArrayClear(tabSkillShopItemsDataHaveNotLearn)
|
||||
end
|
||||
|
||||
function UIModelAdventureSkill:GetSkillShopItemsDataHaveNotLearn()
|
||||
return tabSkillShopItemsDataHaveNotLearn
|
||||
end
|
||||
|
||||
function UIModelAdventureSkill:GetSkillShopItemsDataHaveNotLearn_PreSkillBeLearned()
|
||||
TableUtility.ArrayClear(gReusableArray)
|
||||
for _, v in pairs(tabSkillShopItemsDataHaveNotLearn) do
|
||||
local skillShopItemData = v
|
||||
local skillID = skillShopItemData.SkillID
|
||||
if skillID and skillID > 0 then
|
||||
local skillConf = Table_Skill[skillID]
|
||||
local filedCondition = skillConf.Contidion
|
||||
if filedCondition ~= nil then
|
||||
local preSkillID = filedCondition.skillid
|
||||
if preSkillID == nil then
|
||||
table.insert(gReusableArray, skillShopItemData)
|
||||
elseif preSkillID > 0 then
|
||||
if FuncAdventureSkill.Instance():SkillIsHaveLearned(preSkillID) then
|
||||
table.insert(gReusableArray, skillShopItemData)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return gReusableArray
|
||||
end
|
||||
|
||||
function UIModelAdventureSkill:GetAdventureLevel()
|
||||
local appellation = MyselfProxy.Instance:GetCurManualAppellation();
|
||||
return appellation and appellation.id or 1;
|
||||
end
|
||||
|
||||
-- need optimize
|
||||
function UIModelAdventureSkill:SortFromUnlockToLock(tab_skill_shop_items_data)
|
||||
local adventureLevel = self:GetAdventureLevel()
|
||||
if adventureLevel == nil or adventureLevel <= 0 then
|
||||
LogUtility.Error(string.format('Local variable adventureLevel is illegal'))
|
||||
else
|
||||
if tab_skill_shop_items_data ~= nil and not table.IsEmpty(tab_skill_shop_items_data) then
|
||||
local lockSkillShopItems = {}
|
||||
local lockSkillShopItemsAppellation = {}
|
||||
for i = #tab_skill_shop_items_data, 1, -1 do
|
||||
local skillShopItemData = tab_skill_shop_items_data[i]
|
||||
local requireAppellation = self:GetSkillRequireAppellation(skillShopItemData.id)
|
||||
if requireAppellation > adventureLevel then
|
||||
lockSkillShopItems[skillShopItemData.id] = skillShopItemData
|
||||
table.insert(lockSkillShopItemsAppellation, {id = skillShopItemData.id, appellation = requireAppellation})
|
||||
table.remove(tab_skill_shop_items_data, i)
|
||||
end
|
||||
end
|
||||
table.sort(lockSkillShopItemsAppellation, function (x, y)
|
||||
return x.appellation < y.appellation
|
||||
end)
|
||||
local sortedLockSkillShopItems = {}
|
||||
for _, v in pairs(lockSkillShopItemsAppellation) do
|
||||
local skillShopItemID = v.id
|
||||
table.insert(sortedLockSkillShopItems, lockSkillShopItems[skillShopItemID])
|
||||
end
|
||||
for _, v in pairs(sortedLockSkillShopItems) do
|
||||
local lockSkillShopItem = v
|
||||
table.insert(tab_skill_shop_items_data, lockSkillShopItem)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UIModelAdventureSkill:SortBaseFieldShopOrder(tab_skill_shop_items_data)
|
||||
if tab_skill_shop_items_data ~= nil and not table.IsEmpty(tab_skill_shop_items_data) then
|
||||
table.sort(tab_skill_shop_items_data, function (x, y)
|
||||
return x.ShopOrder < y.ShopOrder
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function UIModelAdventureSkill:GetSkillRequireAppellation(i_shop_item_id)
|
||||
local retValue = 0
|
||||
if i_shop_item_id and i_shop_item_id > 0 then
|
||||
local skillShopItemData = ShopProxy.Instance:GetShopItemDataByTypeId(
|
||||
FuncAdventureSkill.iShopType,
|
||||
FuncAdventureSkill.Instance().iSerialNumber,
|
||||
i_shop_item_id
|
||||
)
|
||||
local skillID = skillShopItemData.SkillID
|
||||
local skillConf = Table_Skill[skillID]
|
||||
retValue = skillConf.Contidion.riskid
|
||||
end
|
||||
return retValue
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cb5bd13b373042c89d47d818f8b9586
|
||||
timeCreated: 1462346457
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Data/Appellation.meta
Normal file
10
Assets/Resources/Script/Com/Data/Appellation.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9919be5cc61949449b5f205ceb5da3f
|
||||
folderAsset: yes
|
||||
timeCreated: 1462333090
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Resources/Script/Com/Data/Appellation/Appellation.txt
Normal file
26
Assets/Resources/Script/Com/Data/Appellation/Appellation.txt
Normal file
@ -0,0 +1,26 @@
|
||||
--稱號
|
||||
Appellation = class("Appellation")
|
||||
|
||||
function Appellation:ctor(id,titleType,createTime)
|
||||
self:initData()
|
||||
self:ResetData(id,titleType,createTime)
|
||||
end
|
||||
|
||||
function Appellation:initData( )
|
||||
-- body
|
||||
self.id = -1
|
||||
self.titleType = -1
|
||||
self.createTime = 0
|
||||
end
|
||||
|
||||
function Appellation:ResetData(id,titleType,createTime)
|
||||
self.id = id
|
||||
self.staticData = Table_Appellation[id]
|
||||
if(not self.staticData)then
|
||||
errorLog("Appellation:ResetData:can't find staticData in Table_Appellation by id:"..(id or 0))
|
||||
return
|
||||
end
|
||||
self.titleType = titleType
|
||||
self.createTime = createTime
|
||||
end
|
||||
-- return Prop
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f4d5d411e81c41c1ac2e190485a14c0
|
||||
timeCreated: 1462333104
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
69
Assets/Resources/Script/Com/Data/ArtifactItemData.txt
Normal file
69
Assets/Resources/Script/Com/Data/ArtifactItemData.txt
Normal file
@ -0,0 +1,69 @@
|
||||
ArtifactItemData = class("ArtifactItemData")
|
||||
|
||||
function ArtifactItemData:ctor(data)
|
||||
self:SetItemData(data)
|
||||
end
|
||||
|
||||
function ArtifactItemData:SetItemData(data)
|
||||
self.guid = data.guid
|
||||
self.itemID = data.itemid
|
||||
self.staticData = Table_Artifact[self.itemID]
|
||||
self.itemStaticData = Table_Item[self.itemID]
|
||||
self.type=self.staticData.Type
|
||||
-- helplog("itemID: ",self.itemID,"type: ",self.type)
|
||||
self.distributeCount = data.distributecount
|
||||
self.retrieveTime = data.retrievetime
|
||||
self.ownerID = data.ownerid
|
||||
-- helplog("ownerID: ",self.ownerID,"mySelfID: ",Game.Myself.data.id)
|
||||
self:SetPhase()
|
||||
end
|
||||
|
||||
function ArtifactItemData:SetPhase()
|
||||
local unUsing = self.ownerID==0
|
||||
local retrieving = self.retrieveTime==0
|
||||
if (unUsing)then
|
||||
self.Phase=ArtifactProxy.OptionType.Distribute
|
||||
elseif(retrieving)then
|
||||
self.Phase=ArtifactProxy.OptionType.Retrieve
|
||||
else
|
||||
self.Phase=ArtifactProxy.OptionType.RetrieveCancle
|
||||
end
|
||||
end
|
||||
|
||||
function ArtifactItemData:CanDistribute()
|
||||
local csvCount = self.staticData and self.staticData.DistributeCount
|
||||
if(csvCount)then
|
||||
return self.distributeCount<csvCount
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function ArtifactItemData:CanEquip(pro)
|
||||
local equipCsv = Table_Equip[self.itemID]
|
||||
if(equipCsv)then
|
||||
local array = equipCsv.CanEquip
|
||||
if(array)then
|
||||
for i=1,#array do
|
||||
if(0==array[i] or array[i]==pro)then -- 0 全職業
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
ArtifactTypeData = class("ArtifactTypeData")
|
||||
|
||||
function ArtifactTypeData:ctor(data)
|
||||
self:SetData(data)
|
||||
end
|
||||
|
||||
function ArtifactTypeData:SetData(data)
|
||||
self.type=data.type
|
||||
self.produceCount=data.producecount
|
||||
-- helplog("ArtifactTypeData: type : ",self.type,"produceCount: ",self.produceCount)
|
||||
self.maxLv=data.maxlevel
|
||||
end
|
||||
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db23d19286e644ec0bdc07ce2801bcbb
|
||||
timeCreated: 1514464654
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Resources/Script/Com/Data/AttrEffect.meta
Normal file
10
Assets/Resources/Script/Com/Data/AttrEffect.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2095bb852c5f44c5ba2401bceef8e51d
|
||||
folderAsset: yes
|
||||
timeCreated: 1456297758
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
122
Assets/Resources/Script/Com/Data/AttrEffect/AttrEffect.txt
Normal file
122
Assets/Resources/Script/Com/Data/AttrEffect/AttrEffect.txt
Normal file
@ -0,0 +1,122 @@
|
||||
AttrEffect = class("AttrEffect")
|
||||
|
||||
-- AttrEffect=1 魔法傷害免疫 1 << 0
|
||||
-- AttrEffect=2 物理傷害免疫 1 << 1
|
||||
-- AttrEffect=3 血量無法恢復 1 << 2
|
||||
-- AttrEffect=4 魔法無法恢復 1 << 3
|
||||
-- AttrEffect=5 吟唱不會中斷 1 << 4
|
||||
-- AttrEffect=6 無視種族傷害 1 << 5
|
||||
-- AttrEffect=7 無視體型傷害 1 << 6
|
||||
-- AttrEffect=8 無視屬性傷害 1 << 7
|
||||
-- AttrEffect=9 無視近戰普攻傷害 1 << 8
|
||||
-- AttrEffect=10 必定命中且暴擊 1 << 9
|
||||
-- AttrEffect=17 隱匿狀態 1 << 16
|
||||
-- AttrEffect=20 無敵狀態 1 << 19
|
||||
-- AttrEffect=27 致盲狀態 1 << 26
|
||||
|
||||
function AttrEffect:ctor()
|
||||
self:Set(0)
|
||||
end
|
||||
|
||||
function AttrEffect:Set(num)
|
||||
self.behaviour = num
|
||||
end
|
||||
|
||||
function AttrEffect:Get(flag)
|
||||
return BitUtil.bandOneZero(self.behaviour,flag)
|
||||
end
|
||||
|
||||
--魔法傷害免疫
|
||||
function AttrEffect:MagicDamageInvincible()
|
||||
return self:Get(0) >0
|
||||
end
|
||||
|
||||
--物理傷害免疫
|
||||
function AttrEffect:PhysicDamageInvincible()
|
||||
return self:Get(1) >0
|
||||
end
|
||||
|
||||
--血量無法恢復
|
||||
function AttrEffect:HpDisableRecover()
|
||||
return self:Get(2) >0
|
||||
end
|
||||
|
||||
--魔法無法恢復
|
||||
function AttrEffect:MpDisableRecover()
|
||||
return self:Get(3) >0
|
||||
end
|
||||
|
||||
--吟唱不會中斷
|
||||
function AttrEffect:SingDisableInterrupt()
|
||||
return self:Get(4) >0
|
||||
end
|
||||
|
||||
--無視種族傷害
|
||||
function AttrEffect:IgnoreRaceDamage()
|
||||
return self:Get(5) >0
|
||||
end
|
||||
|
||||
--無視體型傷害
|
||||
function AttrEffect:IgnoreShapeDamage()
|
||||
return self:Get(6) >0
|
||||
end
|
||||
|
||||
--無視屬性傷害
|
||||
function AttrEffect:IgnoreAttrDamage()
|
||||
return self:Get(7) >0
|
||||
end
|
||||
|
||||
--無視近戰普攻傷害
|
||||
function AttrEffect:IgnoreJinzhanDamage()
|
||||
return self:Get(8) >0
|
||||
end
|
||||
|
||||
--必定命中且暴擊
|
||||
function AttrEffect:DefiniteHitAndCritical()
|
||||
return self:Get(9) >0
|
||||
end
|
||||
|
||||
--無敵狀態
|
||||
function AttrEffect:InvincibleState()
|
||||
return self:Get(19) >0
|
||||
end
|
||||
|
||||
--致盲狀態
|
||||
function AttrEffect:BlindnessState()
|
||||
return self:Get(26) >0
|
||||
end
|
||||
|
||||
|
||||
AttrEffectB = class("AttrEffectB")
|
||||
|
||||
-- AttrEffectB=2 下個區域型技能範圍擴大至x 1 << 1
|
||||
-- AttrEffectB=8 下一次讀條類技能順發 1 << 7
|
||||
-- AttrEffectB=16 無法被敵方作為技能目標 1 << 14
|
||||
-- AttrEffectB=20 處於魔導機械變身狀態 1 << 19
|
||||
function AttrEffectB:ctor()
|
||||
self:Reset()
|
||||
end
|
||||
|
||||
function AttrEffectB:Reset()
|
||||
self.value = 0
|
||||
end
|
||||
|
||||
function AttrEffectB:Set(value)
|
||||
self.value = value
|
||||
end
|
||||
|
||||
function AttrEffectB:NextPointTargetSkillLargeLaunchRange()
|
||||
return self.value & 2 > 0
|
||||
end
|
||||
|
||||
function AttrEffectB:NextSkillNoReady()
|
||||
return self.value & 128 > 0
|
||||
end
|
||||
|
||||
function AttrEffectB:CanNotBeSkillTargetByEnemy()
|
||||
return self.value & 32768 > 0
|
||||
end
|
||||
|
||||
function AttrEffectB:IsInMagicMachine()
|
||||
return BitUtil.bandOneZero(self.value,19) > 0
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user