Skip to content

Commit

Permalink
android x example
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Sachkov committed Jan 21, 2020
1 parent 4c8712b commit e19d7f6
Show file tree
Hide file tree
Showing 502 changed files with 40,580 additions and 0 deletions.

Large diffs are not rendered by default.

450 changes: 450 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assembly-CSharp-Editor.csproj

Large diffs are not rendered by default.

380 changes: 380 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assembly-CSharp-firstpass.csproj

Large diffs are not rendered by default.

408 changes: 408 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assembly-CSharp.csproj

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Editor/EditorBuildTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.IO;
using UnityEditor.Android;
using UnityEngine;

public class EditorBuildTool : IPostGenerateGradleAndroidProject
{
public void OnPostGenerateGradleAndroidProject(string path)
{
Debug.Log("Bulid path : " + path);
string gradlePropertiesFile = path + "/gradle.properties";
if (File.Exists(gradlePropertiesFile))
{
File.Delete(gradlePropertiesFile);
}
StreamWriter writer = File.CreateText(gradlePropertiesFile);
writer.WriteLine("org.gradle.jvmargs=-Xmx4096M");
writer.WriteLine("android.useAndroidX=true");
writer.WriteLine("android.enableJetifier=true");
writer.Flush();
writer.Close();
}

public int callbackOrder { get; private set; }
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Example.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Example/Ads.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Ads : MonoBehaviour {

public Text adstate;
#if GAME_OF_WHALES
// Use this for initialization
void Start () {
GameOfWhales.OnAdClosed += OnAdClosed;
GameOfWhales.OnAdLoadFailed += OnAdLoadFailed;
GameOfWhales.OnAdLoaded += OnAdLoaded;

adstate.text = "hello";
}

// Update is called once per frame
void Update () {

}

public void LoadAd()
{
adstate.text = "ad loading";
GameOfWhales.LoadAd();
}


public void ShowAd()
{
adstate.text = "ad showing";
if (GameOfWhales.IsAdLoaded())
{
GameOfWhales.ShowAd();
}
else
{
adstate.text = "nothing to show, loading";
GameOfWhales.LoadAd();
}
}

private void OnAdLoadFailed()
{
adstate.text = "ad load failed";
}

private void OnAdClosed()
{
adstate.text = "ad closed";
}

private void OnAdLoaded()
{
adstate.text = "ad loaded";
}
#endif
}
12 changes: 12 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Example/Ads.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Example/BroadcastView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BroadcastView : MonoBehaviour
{


private static AndroidJavaObject gameofwhales = null;

void Start()
{
#if UNITY_ANDROID && !UNITY_EDITOR
using(var pluginClass = new AndroidJavaClass("com.gameofwhales.unityplugin.GameOfWhalesProxy"))
{
gameofwhales = pluginClass.CallStatic<AndroidJavaObject>("instance");
}
#endif
}

// Update is called once per frame
void Update()
{

}

public void OnInitRequestClicked()
{
gameofwhales.Call("test_BroadcastInitRequest");
}

public void OnUserRequestClicked()
{
gameofwhales.Call("test_BroadcastUserStatusRequest");
}


public void OnAdShowRequestClicked()
{
gameofwhales.Call("test_BroadcastShowAdRequest");
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Example/Dialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class Dialog : MonoBehaviour {


public Text title;
public Text message;
public Text camp;

string campID = "";
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

public void Show(string title, string message, string camp)
{
gameObject.SetActive(true);
this.title.text = "Title: " + title;
this.message.text = "Message: " + message;
this.camp.text = "Campaign ID: " + camp;
campID = camp;
}

public void Hide()
{
gameObject.SetActive(false);
}

#if GAME_OF_WHALES
public void OnClickOK()
{
GameOfWhales.PushReacted(campID);
campID = "";
Hide();
}
#endif
}
12 changes: 12 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Example/Dialog.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Example/Errors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Net.Mime;

public class Errors : MonoBehaviour {

Text sometext;
public Text futureOffers;
public Text properties;

public static string foOffersList;
// Use this for initialization
void Awake () {
GowPageView.OnPageChangedEvent += OnPageChanged;

}

// Update is called once per frame
void Update ()
{
futureOffers.text = foOffersList;
}

public void ErrorMessage()
{
Debug.LogError("This is test error message");
}

public void NullPointerError()
{
sometext.text = "Error";
}

public void ZeroDevide()
{
int x = 0;
int y = 5;
x = y / x;
}

void OnPageChanged()
{
var props = GameOfWhales.GetProperties();
properties.text = GameOfWhalesJson.MiniJSON.Serialize(props);
}

void OnFutureSpecialOfferAppeared(SpecialOffer offer)
{

}
}
12 changes: 12 additions & 0 deletions Unity5/Examples/Purchase_AndroidX/Assets/Example/Errors.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e19d7f6

Please sign in to comment.