Skip to content

Commit

Permalink
latest version
Browse files Browse the repository at this point in the history
added privacy htm
  • Loading branch information
Brad Gearon committed Nov 18, 2020
1 parent 3680470 commit 171f80e
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 29 deletions.
Binary file modified Assets/Packages/I2/Resources/I2Languages.prefab
Binary file not shown.
5 changes: 2 additions & 3 deletions Assets/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:theme="@style/UnityThemeSelector"
android:launchMode="singleInstance">
<application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
Binary file modified Assets/Resources/GameManager.prefab
Binary file not shown.
Binary file modified Assets/Resources/Image.prefab
Binary file not shown.
53 changes: 53 additions & 0 deletions Assets/Scripts/AdLauncher.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;

public class AdLauncher : MonoBehaviour {

public string zoneId = "defaultVideoAndPictureZone";

void Start () {
Advertisement.Initialize("1234567", true);
}

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

}

public void ShowAdPlacement()
{
if (string.IsNullOrEmpty(zoneId))
{
zoneId = null;
}

if (false && DateTime.Now < new DateTime(2016, 11, 24))
{
return;
}

ShowOptions options = new ShowOptions();
options.resultCallback = HandleShowResult;
Advertisement.Show(options);
}

private void HandleShowResult(ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
Debug.Log("Video completed. Offer a reward to the player.");
break;
case ShowResult.Skipped:
Debug.LogWarning("Video was skipped.");
break;
case ShowResult.Failed:
Debug.LogError("Video failed to show.");
break;
}
}


}
34 changes: 29 additions & 5 deletions Assets/Scripts/DragDropHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,17 @@ private IEnumerator CheckMatchedTiles([CanBeNull] TileManager tileManager)
tileManager.ReplaceTile(dragged, droppedOn);

var matches = new List<Tile[]>();
var draggedMatches = tileManager.FindMatches(dragged).ToArray();
var droppedMatches = tileManager.FindMatches(droppedOn).ToArray();

var draggedMatches = tileManager.FindMatches(dragged);
var droppedMatches = tileManager.FindMatches(droppedOn);

Func<IEnumerable<Tile>, bool> notNull = l => l != null;

foreach (var gr in draggedMatches.Where(notNull))
foreach (var tiles in draggedMatches)
{
var tiles = gr as Tile[] ?? gr.ToArray();
var toAdd = tiles;
foreach (var gri in droppedMatches.Where(notNull))

foreach (var gri in droppedMatches)
{
var enumerable = gri.ToArray();
if (toAdd.Intersect(enumerable).Any()
Expand All @@ -105,9 +106,32 @@ private IEnumerator CheckMatchedTiles([CanBeNull] TileManager tileManager)
toAdd = enumerable;
}
}

matches.Add(toAdd);
}

var first = droppedMatches.OrderBy(t => t.Length).FirstOrDefault();
if (first != null)
{
matches.Add(first);
}

foreach (var tiles in droppedMatches)
{
var toAdd = tiles;
foreach (var gr in draggedMatches)
{
var enumerable = gr.ToArray();
if (toAdd.Intersect(enumerable).Any()
&& enumerable.Count() > tiles.Count())
{
toAdd = enumerable;
}

matches.Add(toAdd);
}
}

Debug.Log("step taken");
ScoreManager.Instance.TakeStep();

Expand Down
18 changes: 6 additions & 12 deletions Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using DG.Tweening;
using DG.Tweening.Core;
using Facebook.Unity;
using I2.Loc;

public class GameManager : MonoBehaviour
{
Expand Down Expand Up @@ -38,13 +37,8 @@ public class GameManager : MonoBehaviour
public Level[] Levels = new Level[12];
public int LevelIndex = 0;



void Awake()
{

Debug.Log("on awake:" + Application.systemLanguage);
Debug.Log("current I2 Language: " + LocalizationManager.CurrentLanguage);
Instance = this;
_screenFader = GetComponent<ScreenFader>();

Expand All @@ -59,11 +53,6 @@ void Awake()
}
}


#if !UNITY_EDITOR
UntitledLauncher.Init();
#endif

if (FB.IsInitialized)
{
FB.ActivateApp();
Expand All @@ -72,7 +61,6 @@ void Awake()
{
FB.Init(FB.ActivateApp);
}

}

void Start()
Expand Down Expand Up @@ -205,4 +193,10 @@ public void OnTrackAppNext()
var tracking = GetComponent<AppNextTracking>();
tracking.Track();
}

public void ShowAd()
{
var ads = GetComponent<AdLauncher>();
ads.ShowAdPlacement();
}
}
2 changes: 1 addition & 1 deletion Assets/Scripts/GameOverManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ IEnumerator ShowResults(Transform starTransform, Level level)

if (Random.Range(0f, 1f) < .77f)
{
UntitledLauncher.Show();
GameManager.Instance.ShowAd();
}

nextButton.gameObject.SetActive(didWin);
Expand Down
31 changes: 23 additions & 8 deletions Assets/Scripts/TileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ public Tile FindMatchingTile(Transform toFind)
/// </summary>
/// <param name="current">starting point</param>
/// <returns>a list of lists... of tiles</returns>
public IEnumerable<IEnumerable<Tile>> FindMatches(Tile current)
public Tile[][] FindMatches(Tile current)
{
Debug.Log("enter find matches");

return CheckDirections(current);
}

private IEnumerable<IEnumerable<Tile>> CheckDirections(Tile current)
private Tile[][] CheckDirections(Tile current)
{
var matches = new TileMatch[4];

Expand All @@ -218,9 +218,20 @@ private IEnumerable<IEnumerable<Tile>> CheckDirections(Tile current)
matches[2] = GetMatchesNew(current, TileAxis.Vertical, 1, default(TileMatch));
matches[3] = GetMatchesNew(current, TileAxis.Vertical, -1, matches[2]);

return matches
.Where(arr => arr.Tiles.Length > 2)
.Select(arr => arr.Tiles.AsEnumerable());
var eligibleCount = matches.Count(match => match.Tiles.Length > 2);

var eligible = new Tile[eligibleCount][];
var ii = 0;

foreach (var match in matches)
{
if (match.Tiles.Length > 2)
{
eligible[ii++] = match.Tiles;
}
}

return eligible;
}

/// <summary>
Expand Down Expand Up @@ -353,7 +364,9 @@ private TileMatch GetPreviousMatches(TileMatch match, TileMatch current)
if (previousMatching.Any())
{
match.Factors = previousMatching;
match.Tiles = match.Tiles.Union(current.Tiles).ToArray();
match.Tiles = match.Tiles
.Where(t => !current.Tiles.Contains(t))
.Union(current.Tiles).ToArray();
}

return match;
Expand All @@ -379,9 +392,11 @@ private TileMatch getMatches(TileMatch match, int start, int offset, int max)
tiles.Add(tile);
}

match.Factors = factors;

return new TileMatch
{
Tiles = tiles.ToArray(),
Tiles = tiles.Distinct().ToArray(),
Factors = factors
};
}
Expand All @@ -403,7 +418,7 @@ private TileMatch GetMatchesNew(Tile start, TileAxis axis, int direction,
};

var newMatch = getMatches(tileMatch, start.Index + offset, offset, max);
var previous = GetPreviousMatches(previousMatch, tileMatch);
var previous = GetPreviousMatches(previousMatch, newMatch);

if (previous.Factors != null)
{
Expand Down
Binary file modified Library/CurrentLayout.dwlt
Binary file not shown.
Binary file modified Library/ProjectSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/EditorBuildSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/ProjectSettings.asset
Binary file not shown.
1 change: 1 addition & 0 deletions privacy.htm

Large diffs are not rendered by default.

0 comments on commit 171f80e

Please sign in to comment.