Git Product home page Git Product logo

myket-iap-godot's Introduction

Logo

پرداخت درون برنامه ای مایکت

سازگار با ورژن 4.1 گودوت

نمایش کتابخانه »

مشاهده دمو . گزارش مشکل . درخواست ویژگی

Downloads Contributors Issues License

نحوه راه اندازی

پلاگین را روی پروژه خود نصب کنید و برای راه اندازی ان از مثال فولدر GDProject استفاده کنید.

حتما تیک پلاگین را از اکسپورت فعال کنید.

کد مثال

extends Node2D
@onready var resPopup: Popup = $Control/ResPop
@onready var resLbl: Label = $Control/ResPop/ResPanel/ResVB/ResLbl

var myketBilling: JNISingleton = null
const SKU_PREMIUM = "SDSDSA" # شناسه ی محصول

func _ready() -> void:
	if Engine.has_singleton("MyketInAppBilling"):
		myketBilling = Engine.get_singleton("MyketInAppBilling")
		myketBilling.setApplicationKey("") # کلید فعالسازی پرداخت درون برنامه ای که در پنل مایکت موجود می باشد
		myketBilling.connect("connected", Callable(self, "_on_MyketConnected"))
		myketBilling.connect("query_sku_details_finished", Callable(self,"_on_MyketQuerySkuFinished"))
		myketBilling.connect("purchase_finished", Callable(self,"_on_MyketPurchaseFinished"))
	else:
		print("No MyketInAppBilling plugin.")
	
	return
	




func _on_Button_pressed() -> void:
	if myketBilling == null:
		resLbl.text = "InAppBilling plugin is not available for this device." # در دسترس نبودن پلاگین
		resPopup.show()
		return
	
	myketBilling.startConnection()
	
	return
	


func _on_MyketConnected(successful: bool, resMsg: String) -> void:
	print("Connected: ", str(successful))
	
	if successful:
		myketBilling.querySkuDetails() # دریافت اطلاعات
	else:

		resLbl.text = resMsg
		resPopup.show()
		pass
	
	return
	


func _on_MyketQuerySkuFinished(results: Array) -> void: # بعداز دریافت اطلاعات
	for res in results:
		print(res)
	
	if not results.has(SKU_PREMIUM):
		print(myketBilling.purchase(SKU_PREMIUM))
	else:
		_setGamePremium()
		pass
	
	return
	


func _on_MyketPurchaseFinished(result: Dictionary) -> void: # پرداخت موفق
	print("Purchase Finished: ", result)
	
	return
	


func _setGamePremium() -> void: # پرمیوم کاربر

	print("Game is premium now.")
	return

myket-iap-godot's People

Contributors

theundername avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.