mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Add LinkAction (#12542)
* Add LinkAction * fix generated stuff (tested in desktop)
This commit is contained in:

committed by
GitHub

parent
8a376de6c3
commit
b1f1998f11
@ -1,5 +1,6 @@
|
|||||||
package com.unciv.logic.civilization
|
package com.unciv.logic.civilization
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.math.Vector2
|
import com.badlogic.gdx.math.Vector2
|
||||||
import com.badlogic.gdx.utils.Json
|
import com.badlogic.gdx.utils.Json
|
||||||
import com.badlogic.gdx.utils.JsonValue
|
import com.badlogic.gdx.utils.JsonValue
|
||||||
@ -182,6 +183,13 @@ class EspionageAction : NotificationAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class LinkAction(private val url: String = "") : NotificationAction {
|
||||||
|
override fun execute(worldScreen: WorldScreen) {
|
||||||
|
if (url.isNotEmpty()) {
|
||||||
|
Gdx.net.openURI(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Suppress("PrivatePropertyName") // These names *must* match their class name, see below
|
@Suppress("PrivatePropertyName") // These names *must* match their class name, see below
|
||||||
internal class NotificationActionsDeserializer {
|
internal class NotificationActionsDeserializer {
|
||||||
@ -206,13 +214,14 @@ internal class NotificationActionsDeserializer {
|
|||||||
private val OverviewAction: OverviewAction? = null
|
private val OverviewAction: OverviewAction? = null
|
||||||
private val PolicyAction: PolicyAction? = null
|
private val PolicyAction: PolicyAction? = null
|
||||||
private val EspionageAction: EspionageAction? = null
|
private val EspionageAction: EspionageAction? = null
|
||||||
|
private val LinkAction: LinkAction? = null
|
||||||
|
|
||||||
fun read(json: Json, jsonData: JsonValue): List<NotificationAction> {
|
fun read(json: Json, jsonData: JsonValue): List<NotificationAction> {
|
||||||
json.readFields(this, jsonData)
|
json.readFields(this, jsonData)
|
||||||
return listOfNotNull(
|
return listOfNotNull(
|
||||||
LocationAction, TechAction, CityAction, DiplomacyAction, MayaLongCountAction,
|
LocationAction, TechAction, CityAction, DiplomacyAction, MayaLongCountAction,
|
||||||
MapUnitAction, CivilopediaAction, PromoteUnitAction, OverviewAction, PolicyAction,
|
MapUnitAction, CivilopediaAction, PromoteUnitAction, OverviewAction, PolicyAction,
|
||||||
EspionageAction
|
EspionageAction, LinkAction
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user