Example #1
0
 public void Fetch(Roar.Callback< IDictionary<string,Foo> > callback)
 {
     Hashtable data = new Hashtable();
     data.Add("board_id", boardId);
     data.Add("page", page.ToString());
     dataStore.ranking.Fetch(callback, data);
 }
Example #2
0
 /*
  * public void AddNullInput()
  * {
  *  FileLoader fl = new FileLoader(this, 32);
  *  var wrote = fl.LoadFromMem(new byte[MagicNumbers.PAGE_SIZE]);
  * }
  */
 public void LoadBDB(string aFile)
 {
     if (File.Exists(aFile))
     {
         var bdbytes = File.ReadAllBytes(aFile);
         r = Roar.read(bdbytes, false);
     }
 }
Example #3
0
 static void onShopFetch( Roar.CallbackInfo info )
 {
     Debug.Log( "onShopFetch Called" );
     Debug.Log(info);
     Debug.Log(info.code);
     Debug.Log(info.msg);
     Debug.Log(info.d);
 }
Example #4
0
 static void onShopFetch( Roar.CallbackInfo< IDictionary<string, Roar.DomainObjects.ShopEntry> > info )
 {
     Debug.Log( "onShopFetch Called" );
     Debug.Log(info);
     Debug.Log(info.code);
     Debug.Log(info.msg);
     Debug.Log(info.data);
 }
Example #5
0
 static void LoadChangedLeaderboard(Roar.WebObjects.Leaderboards.ViewResponse response)
 {
     foreach(LeaderboardEntry e in response.leaderboard_data.entries)
     {
         if(!playerIDleaderboardDict.ContainsKey(e.player_id))
         {
             playerIDleaderboardDict.Add(e.player_id, e.properties);
         }
     }
 }
Example #6
0
 static void onLogin( Roar.CallbackInfo info )
 {
     Debug.Log( "onLogin Called" );
     Debug.Log(info);
     Debug.Log(info.code);
     Debug.Log(info.msg);
     Debug.Log(info.d);
     IRoar roar = DefaultRoar.Instance;
     roar.Shop.Fetch( onShopFetch );
 }
Example #7
0
 static void onLogin( Roar.CallbackInfo< Roar.WebObjects.User.LoginResponse > info )
 {
     Debug.Log( "onLogin Called" );
     Debug.Log(info);
     Debug.Log(info.code);
     Debug.Log(info.msg);
     Debug.Log(info.data);
     IRoar roar = DefaultRoar.Instance;
     roar.Shop.Fetch( onShopFetch );
 }
Example #8
0
 private void Awake()
 {
     idle           = new Idle(playerAnim, idleAnimation);
     moving         = new Moving(playerAnim, movingAnimation);
     roar           = new Roar(playerAnim, roarAnimation, ReturnFromRoarLogic);
     death          = new Death(playerAnim, deathAnimation, returnDeathAnimation, transform);
     bite           = new Bite(playerAnim, biteAnimation, ReturnFromBiteLogic);
     isInvulnerable = false;
     playerHasKey   = false;
     audioSource    = GetComponent <AudioSource>();
 }
Example #9
0
        public void SetDefault()
        {
            hornColor  = new Color(180, 140, 60);
            scaleColor = new Color(255, 50, 50);
            bellyColor = new Color(250, 220, 130);
            eyeColor   = new Color(100, 100, 220);

            name = "Draggy the Dragon";

            roar = Roar.normal;

            stage = GrowthStage.egg;
            gear  = null;
        }
Example #10
0
        public void Load(TagCompound tag)
        {
            hornColor  = tag.Get <Color>(nameof(hornColor));
            scaleColor = tag.Get <Color>(nameof(scaleColor));
            bellyColor = tag.Get <Color>(nameof(bellyColor));
            eyeColor   = tag.Get <Color>(nameof(eyeColor));

            name = tag.GetString(nameof(name));

            roar = (Roar)tag.GetInt(nameof(roar));

            stage = (GrowthStage)tag.GetInt(nameof(stage));
            gear  = tag.Get <Item>(nameof(gear));
        }
Example #11
0
        /**
        * Fetches details about `items` array and adds to item Cache Model
        */
        public bool AddToCache(ArrayList items, Roar.Callback cb=null)
        {
            ArrayList batch = ItemsNotInCache (items);

            // Make the call if there are new items to fetch,
            // passing the `batch` list and persisting the Model data (adding)
            // Returns `true` if items are to be added, `false` if nothing to add
            if (batch.Count > 0) {
                var keysAsJSON = Roar.Json.ArrayToJSON (batch) as string;
                Hashtable args = new Hashtable ();
                args ["item_ikeys"] = keysAsJSON;
                Fetch (cb, args, true);
                return true;
            } else
                return false;
        }
Example #12
0
        /// <summary>
        /// HashDB manager
        /// MUST BE A POWER OF 2
        /// </summary>
        /// <param name="minBlockSize">POWER of 2</param>
        /// <param name="DB">Primary DB</param>
        /// <param name="relocFolder">Relocation data</param>
        /// <param name="Size">POWER OF 2!</param>
        public HashDB(int minBlockSize, string DB, string relocFolder, long Size = 0)
        {
            HashDBFile   = DB;
            HashDBBitMap = DB + ".bin";
            if (Size != 0)
            {
                DBSize = (long)FractHashTree.RoundUpPow2(Size);
            }

            if (!File.Exists(HashDBFile))
            {
                if (!FractHashTree.IsPow2(DBSize))
                {
                    throw new InternalBufferOverflowException($"DB SIZE not a power of 2!");
                }

                using (var fileStream = new FileStream(HashDBFile, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
                    fileStream.SetLength(DBSize + (DB_READ_SIZE));
            }
            else
            {
                DBSize = (long)FractHashTree.RoundDownPow2(new FileInfo(HashDBFile).Length);
            }

            // Divide by HASH size
            DBEntries     = (ulong)DBSize >> HASH_SHIFT;
            DBEntriesMask = (ulong)DBEntries - 1;

            MinBlockSize = minBlockSize;

            ReRe = new ReReDB(relocFolder);

            // arbitrarially big
            BDBEntriesMask = (DBEntriesMask << 8) | 0xfff;
            r = new Roar();
            LoadBDB(HashDBBitMap);
            //HDBBitMap = new UnsafeHelp(HashDBBitMap, (long)BDBEntriesMask+1);
        }
Example #13
0
 public void view( Roar.WebObjects.User.ViewArguments args, ZWebAPI.Callback<Roar.WebObjects.User.ViewResponse> cb)
 {
     api.MakeCall ("user/view", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.User.ViewResponse>(cb, view_response_parser), true);
 }
Example #14
0
 public void netdrive_save( Roar.WebObjects.User.NetdriveSaveArguments args, ZWebAPI.Callback<Roar.WebObjects.User.NetdriveSaveResponse> cb)
 {
     api.MakeCall ("user/netdrive_set", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.User.NetdriveSaveResponse>(cb, netdrive_save_response_parser), true);
 }
Example #15
0
 public void login_facebook_oauth( Roar.WebObjects.User.LoginFacebookOauthArguments args, ZWebAPI.Callback<Roar.WebObjects.User.LoginFacebookOauthResponse> cb)
 {
     api.MakeCall ("facebook/login_oauth", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.User.LoginFacebookOauthResponse>(cb, login_facebook_oauth_response_parser), false);
 }
Example #16
0
 public void login( Roar.WebObjects.User.LoginArguments args, ZWebAPI.Callback<Roar.WebObjects.User.LoginResponse> cb)
 {
     api.MakeCall ("user/login", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.User.LoginResponse>(cb, login_response_parser), false);
 }
Example #17
0
 public Hashtable GetAchievement(string ikey, Roar.Callback callback)
 {
     if (callback != null)
         callback (new Roar.CallbackInfo<object> (dataStore.achievements.Get (ikey)));
     return dataStore.achievements.Get (ikey);
 }
Example #18
0
 void OnRoarFetchTasksComplete( Roar.CallbackInfo< IDictionary<string,Roar.DomainObjects.Task> > data )
 {
     isFetching = false;
 }
 void OnRoarFetchRankingsComplete(Roar.CallbackInfo info)
 {
     activeLeaderboard.whenLastFetched = Time.realtimeSinceStartup;
     isFetching = false;
     activeLeaderboard.rankingRaw = activeLeaderboard.ranking.List();
     foreach (Hashtable data in activeLeaderboard.rankingRaw)
     {
         foreach (DictionaryEntry datum in data)
         {
             //Debug.Log(string.Format("{0} => {1}", entry.Key, entry.Value));
             if ((string)datum.Key == "entries")
             {
                 ArrayList entries = (ArrayList)datum.Value;
                 activeLeaderboard.ranks = new List<Rank>(entries.Count);
                 Rank rank;
                 foreach (Hashtable entry in entries)
                 {
                     rank = new Rank();
                     foreach (DictionaryEntry kv in entry)
                     {
                         //Debug.Log(string.Format("{0} => {1}", kv.Key, kv.Value));
                         string k = kv.Key as string;
                         if (k == "rank")
                         {
                             rank.rank = System.Convert.ToInt32(kv.Value);
                         }
                         else if (k == "player_id")
                         {
                             rank.playerId = kv.Value as string;
                         }
                         else if (k == "player_name")
                         {
                             rank.playerName = kv.Value as string;
                         }
                         else if (k == "value")
                         {
                             rank.value = kv.Value as string;
                         }
                     }
                     activeLeaderboard.ranks.Add(rank);
                 }
             }
             else if ((string)datum.Key == "properties")
             {
                 Hashtable properties = (Hashtable)datum.Value;
                 if (properties.ContainsKey("page"))
                     activeLeaderboard.page = System.Convert.ToInt32(properties["page"]);
                 if (properties.ContainsKey("num_results"))
                     activeLeaderboard.numResults = System.Convert.ToInt32(properties["num_results"]);
                 if (properties.ContainsKey("offset"))
                     activeLeaderboard.offset = System.Convert.ToInt32(properties["offset"]);
                 if (properties.ContainsKey("low_is_high"))
                     activeLeaderboard.lowIsHigh = System.Convert.ToBoolean(properties["low_is_high"]);
             }
         }
     }
 }
Example #20
0
 public MockRequestSender(Roar.IConfig config, IUnityObject unity_object, Roar.ILogger logger)
     : base(config, unity_object, logger)
 {
     responses = new Hashtable();
 }
Example #21
0
 public void buy( Roar.WebObjects.Shop.BuyArguments args, ZWebAPI.Callback<Roar.WebObjects.Shop.BuyResponse> cb)
 {
     api.MakeCall ("shop/buy", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.Shop.BuyResponse>(cb, buy_response_parser), true);
 }
Example #22
0
 public Lion()
 {
     Name               = "Lion";
     MoveBehaviour      = new Walks();
     MakeSoundBehaviour = new Roar();
 }
Example #23
0
 public void _set( Roar.WebObjects.User.SetArguments args, ZWebAPI.Callback<Roar.WebObjects.User.SetResponse> cb)
 {
     api.MakeCall ("user/set", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.User.SetResponse>(cb, set_response_parser), true);
 }
Example #24
0
 public void list( Roar.WebObjects.Shop.ListArguments args, ZWebAPI.Callback<Roar.WebObjects.Shop.ListResponse> cb)
 {
     api.MakeCall ("shop/list", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.Shop.ListResponse>(cb, list_response_parser), true);
 }
Example #25
0
 void OnRoarPropertiesFetched(Roar.CallbackInfo< IDictionary<string,Roar.DomainObjects.PlayerAttribute> > info)
 {
     networkActionInProgress = false;
     if (OnFullyLoggedIn != null) OnFullyLoggedIn();
 }
Example #26
0
 public void start( Roar.WebObjects.Tasks.StartArguments args, ZWebAPI.Callback<Roar.WebObjects.Tasks.StartResponse> cb)
 {
     api.MakeCall ("tasks/start", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.Tasks.StartResponse>(cb, start_response_parser), true);
 }
Example #27
0
 public void ios_register( Roar.WebObjects.Urbanairship.IosRegisterArguments args, ZWebAPI.Callback<Roar.WebObjects.Urbanairship.IosRegisterResponse> cb)
 {
     api.MakeCall ("urbanairship/ios_register", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.Urbanairship.IosRegisterResponse>(cb, ios_register_response_parser), true);
 }
    void OnRoarFetchLeaderboardsComplete(Roar.CallbackInfo info)
    {
        whenLastFetched = Time.realtimeSinceStartup;
        isFetching = false;
        leaderboardsRaw = boards.List();

        leaderboards = new List<Leaderboard>(leaderboardsRaw.Count);
        Leaderboard leaderboard;
        foreach (Hashtable data in leaderboardsRaw)
        {
            leaderboard = new Leaderboard();
            leaderboard.id = data["board_id"] as string;
            leaderboard.key = data["ikey"] as string;
            leaderboard.label = data["label"] as string;
            if (leaderboard.label.Length == 0)
                leaderboard.label = string.Format("Leaderboard{0}", leaderboard.id);
            leaderboard.ranking = new Roar.implementation.Components.Ranking(leaderboard.id, roar.DataStore, roar.Logger);

            leaderboards.Add(leaderboard);
        }
    }
Example #29
0
 public void push( Roar.WebObjects.Urbanairship.PushArguments args, ZWebAPI.Callback<Roar.WebObjects.Urbanairship.PushResponse> cb)
 {
     api.MakeCall ("urbanairship/push", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.Urbanairship.PushResponse>(cb, push_response_parser), true);
 }
Example #30
0
 void OnRoarAccountCreateComplete(Roar.CallbackInfo<Roar.WebObjects.User.CreateResponse> info)
 {
     if (Debug.isDebugBuild)
         Debug.Log(string.Format("OnRoarAccountCreateComplete ({0}): {1}", info.code, info.msg));
     switch (info.code)
     {
     case IWebAPI.OK: // (success)
         status = "Account successfully created. You can now log in.";
         break;
     case 3:
     default:
         status = info.msg;
         break;
     }
     networkActionInProgress = false;
 }
Example #31
0
 public void achievements( Roar.WebObjects.User.AchievementsArguments args, ZWebAPI.Callback<Roar.WebObjects.User.AchievementsResponse> cb)
 {
     api.MakeCall ("user/achievements", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.User.AchievementsResponse>(cb, achievements_response_parser), true);
 }
Example #32
0
    void OnRoarLoginComplete(Roar.CallbackInfo<Roar.WebObjects.User.LoginResponse> info)
    {
        if (Debug.isDebugBuild)
        {
            Debug.Log(string.Format("OnRoarLoginComplete ({0}): {1}", info.code, info.msg));
            if( info.data!= null)
            {
            Debug.Log( string.Format("OnRoarLoginComplete got auth_token {0}", info.data.auth_token ) );
            Debug.Log( string.Format("OnRoarLoginComplete got player_id {0}",  info.data.player_id ) );
            }
            else
            {
                Debug.Log("OnRoarLogingComplete got null data");
            }
        }
        switch (info.code)
        {
        case IWebAPI.OK: // (success)
            this.enabled = false;
            // fetch the player's properties after successful login
            if (fetchPropertiesOnLogin)
            {
                DefaultRoar.Instance.Properties.Fetch(OnRoarPropertiesFetched);
            }
            else
            {

                networkActionInProgress = false;
            }

            break;
        case 3: // Invalid name or password
        default:
            status = info.msg;
            networkActionInProgress = false;
            break;
        }
    }
Example #33
0
 public void change_password( Roar.WebObjects.User.ChangePasswordArguments args, ZWebAPI.Callback<Roar.WebObjects.User.ChangePasswordResponse> cb)
 {
     api.MakeCall ("user/change_password", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.User.ChangePasswordResponse>(cb, change_password_response_parser), true);
 }
Example #34
0
 public void Fetch(Roar.Callback callback)
 {
     dataStore.achievements.Fetch (callback);
 }
Example #35
0
 public void create( Roar.WebObjects.User.CreateArguments args, ZWebAPI.Callback<Roar.WebObjects.User.CreateResponse> cb)
 {
     api.MakeCall ("user/create", args.ToHashtable(), new CallbackBridge<Roar.WebObjects.User.CreateResponse>(cb, create_response_parser), false);
 }
Example #36
0
 public ArrayList List(Roar.Callback callback)
 {
     if (callback != null)
         callback (new Roar.CallbackInfo<object> (dataStore.achievements.List ()));
     return dataStore.achievements.List ();
 }
Example #37
0
    // Update is called once per frame
    void Update()
    {
        dis      = Vector2.Distance(prev, transform.position);
        prev     = transform.position;
        Monster -= Time.deltaTime;
        if (Monster <= 0)
        {
            if (Roar.activeSelf == false)
            {
                danger.Play();
                Roar.transform.localPosition = new Vector2(-1.21f, transform.position.y - 14f);
            }
            Roar.SetActive(true);
        }
        if (Monster <= -1)
        {
            Roar.SetActive(false);
            Monster += UnityEngine.Random.Range(20f, 40f);
        }

        if (dis <= 0.4 && run)
        {
            if (Stopper <= 0)
            {
                if (stopperCooldown <= 0 && GameManager.Instance.isDead == false)
                {
                    Damaged(1);
                    stopperCooldown = 2;
                }
                stopperCooldown -= Time.deltaTime;
            }
            else
            {
                Stopper -= Time.deltaTime;
            }
        }
        else if (run && Stopper <= 3 && dis >= 0.4)
        {
            Stopper        += Time.deltaTime;
            stopperCooldown = 2;
        }
        if (controller.transform.position.y <= -2)
        {
            curHealth = 0;
        }
        if (curHealth == 0)
        {
            run = false;

            if (Stopper >= 0 && GameManager.Instance.isDead == false)
            {
                controller.Anim.SetTrigger("Death");
                GameManager.Instance.isDead = true;
            }
            else if (Stopper <= 0 && GameManager.Instance.isDead == false)
            {
                Roar.SetActive(true);
                controller.Anim.SetTrigger("Eaten");
                gobble.SetTrigger("Death");
                GameManager.Instance.isDead = true;
            }
        }
        if (curMana >= 1 || Blaster >= 0)
        {
            CanCast = true;
        }
        else
        {
            CanCast = false;
        }

        if (Input.GetKeyDown("e") && CanCast == true && !blasterAnimRunning)
        {
            blasterAnimRunning = true;
            if (Blaster <= 0)
            {
                curMana -= 1;
            }
            controller.Anim.SetTrigger("Spell");
        }
        CameraChecks();
        AblitiesCheck();
        if (run)
        {
            Movement();
        }
        UIElements();                                      //Update UI Elements
        float temp = gameObject.transform.position.x / 10; //Take the distance of the character from x zero and divide it by 10

        ScoreManager.distance = (float)Math.Round(temp);   //Round the value to a whole number and set into the score manager
    }