Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CoD.AddItemToHUD = InheritFrom(LUI.UIElement)
- function CoD.AddItemToHUD.new(HudRef, InstanceRef, image, clientfield)
- local Elem = LUI.UIElement.new()
- Elem:setClass(CoD.AddItemToHUD)
- Elem.id = "AddItemToHUD"
- Elem.soundSet = "default"
- local null_image = RegisterImage("blacktransparent")
- local MainQuestPartC_image = RegisterImage(image)
- local secondary_image = MainQuestPartC_image
- local MainQuestPartCInventory = LUI.UIImage.new(Elem, Instance)
- MainQuestPartCInventory:setLeftRight(true, true, 0, 0)
- MainQuestPartCInventory:setTopBottom(true, true, 0, 0)
- MainQuestPartCInventory:setImage(MainQuestPartC_image)
- MainQuestPartCInventory:setAlpha(0)
- local ShowMainQuestPartCInventory = Engine.CreateModel( Engine.GetModelForController(InstanceRef), clientfield )
- -- Engine.SetModelValue( ShowMainQuestPartCInventory, 0 )
- local function MainQuestPartCInventoryOpen(ModelRef)
- HudRef:updateElementState(MainQuestPartCInventory, {name = "model_validation",
- menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
- modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SCOREBOARD_OPEN})
- end
- local function ImageScoreBoardClientField(ModelRef)
- local rState = Engine.GetModelValue(ModelRef)
- if rState == 1 then
- MainQuestPartCInventory:beginAnimation("keyframe", 350, true, true, CoD.TweenType.Linear)
- --MainQuestPartCInventory:setImage(MainQuestPartC_image)
- MainQuestPartCInventory:setAlpha(1)
- HudRef:updateElementState(MainQuestPartCInventory, {name = "model_validation", menu = HudRef, menu = HudRef, modelValue = Engine.GetModelValue(ModelRef), modelName = clientfield})
- elseif rState == 2 then
- MainQuestPartCInventory:setImage(RegisterImage(secondary_image))
- HudRef:updateElementState(MainQuestPartCInventory, {name = "model_validation", menu = HudRef, menu = HudRef, modelValue = Engine.GetModelValue(ModelRef), modelName = clientfield})
- elseif rState == 0 then
- --MainQuestPartCInventory:setImage(null_image)
- MainQuestPartCInventory:beginAnimation("keyframe", 350, true, true, CoD.TweenType.Linear)
- MainQuestPartCInventory:setAlpha(0)
- HudRef:updateElementState(MainQuestPartCInventory, {name = "model_validation", menu = HudRef, menu = HudRef, modelValue = Engine.GetModelValue(ModelRef), modelName = clientfield})
- end
- end
- MainQuestPartCInventory:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SCOREBOARD_OPEN), MainQuestPartCInventoryOpen)
- MainQuestPartCInventory:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), clientfield), ImageScoreBoardClientField)
- Elem:addElement(MainQuestPartCInventory)
- return Elem
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement