Example #1
0
    public void OnEnable()
    {
        PlayerInfo info = LocalDBController.Table <PlayerInfo>().FirstOrDefault();

        GetComponent <Text>().text = PersianFixer.Fix(info.Name);
        IDText.text = "ID: # " + info.PlayerID;
    }
Example #2
0
 public void SetupHUD()
 {
     HUD.StartClueText.text  = _puzzleIndex == 0 ? PersianFixer.Fix("به چارسو \n خوش آمدید") : PersianFixer.Fix(_puzzle.Clue);
     HUD.HeaderClueText.text = PersianFixer.Fix(_puzzle.Clue);
     HUD.HintClueText.text   = PersianFixer.Fix(_puzzle.Clue);
     HUD.IndexText.text      = PersianFixer.Fix((_puzzle.Row + 1).ToString(), true, true);
 }
Example #3
0
    private void OnEnable()
    {
        var profileManager = ProfileManager.Instance();

        Statistics stat = profileManager.PlayerProfile.PlayerStat;

        level   = BrExpManager.CalLevel(stat.Experience);
        exp     = stat.Experience;
        _prexp  = (level > 0) ? BrExpManager.CalXp(level - 1) : 0;
        _nextxp = BrExpManager.CalXp(level);

        Debug.Log(string.Format("Level : {0} \n start XP : {1} \n Current Level : {2} \n Next Level: {3}", level, exp, _prexp, _nextxp));

        float percentXp = (float)(exp - _prexp) / (_nextxp - _prexp);

        ExperienceSlider.fillAmount = percentXp;
        LevelText.text = PersianFixer.Fix((level + 1).ToString(), true, true);
        int newXP = addedXp + exp;

        StartCoroutine(ShowExpChange(newXP));
        stat.Experience = newXP;
        //stat.Level = BrExpManager.CalLevel(newXP);
        profileManager.PlayerProfile.PlayerStat = stat;
        profileManager.SaveProfile();
    }
Example #4
0
    IEnumerator ShowExpChange(int Desier)
    {
        float speed = 1;// (Desier - exp)/3;

showChange:
        Debug.Log(level);
        //ExperienceSlider.fillAmount = 0;

        while (exp < Desier)
        {
            exp++;
            if (exp > _nextxp)
            {
                level++;
                _prexp  = _nextxp;
                _nextxp = BrExpManager.CalXp(level);
                exp--;
                LevelText.text = PersianFixer.Fix((level + 1).ToString(), true, true);
                ExperienceSlider.fillAmount = 0;
                goto showChange;
            }
            float amount = (float)(exp - _prexp) / (_nextxp - _prexp);

            ExperienceSlider.fillAmount = amount;// / speed;
            yield return(null);
            //yield return ChangeSlider(speed,amount);
        }
    }
    public void ShowMainStats(Statistics stats)
    {
        int level = BrExpManager.CalLevel(stats.Experience);

        if (LevelText != null)
        {
            LevelText.text = PersianFixer.Fix((level + 1).ToString(), true, true);
        }
        if (WinCounText != null)
        {
            WinCounText.text = stats.TotalWins.ToString();
        }
        if (KillCountText != null)
        {
            KillCountText.text = stats.TotalKills.ToString();
        }
        int preXp  = BrExpManager.CalXp(level);
        int nextXp = BrExpManager.CalXp(level + 1);

        LevelProgressImage.fillAmount =
            (float)
            (stats.Experience - preXp) /
            (nextXp - preXp);

        LevelProgressText.text = string.Format(
            "{0}/{1}",
            PersianFixer.Fix((stats.Experience - preXp).ToString(), true, true),
            PersianFixer.Fix((nextXp - preXp).ToString(), true, true));
    }
 public override void Refresh()
 {
     base.Refresh();
     Clue.text    = PersianFixer.Fix((string)OnlinePuzzleController.Instance.ServerRespond["Clue"]);
     Creator.text = PersianFixer.Fix((string)OnlinePuzzleController.Instance.ServerRespond["Creator"]);
     Data.text    = Data.text.Replace("****", PersianFixer.Fix((string)OnlinePuzzleController.Instance.ServerRespond["Sender"]));
 }
    protected override void Refresh(object data)
    {
        var puzzle = (UserPuzzle)data;

        ClueText.text = PersianFixer.Fix(puzzle.Clue);

        RateImage.gameObject.SetActive(puzzle.Rate != null);
        PlayCount.gameObject.SetActive(puzzle.PlayCount.HasValue && puzzle.PlayCount > 0);

        //State.gameObject.SetActive(!string.IsNullOrEmpty(puzzle.CategoryName));
        State.gameObject.SetActive(true);

        State.text =
            puzzle.ServerID == null?ThemeManager.Instance.LanguagePack.GetLable("NotRegister") :
                puzzle.CategoryName == "" ? ThemeManager.Instance.LanguagePack.GetLable("InReview") :
                puzzle.CategoryName == "-" ? ThemeManager.Instance.LanguagePack.GetLable("NoCategory") :
                PersianFixer.Fix(puzzle.CategoryName);


        if (puzzle.PlayCount != null)
        {
            PlayCount.text = PersianFixer.Fix(puzzle.PlayCount + " نفر ", true, true);
        }

        if (puzzle.Rate != null)
        {
            RateImage.fillAmount = puzzle.Rate.Value / 5f;
        }

        GetComponent <RectTransform>().localScale = Vector3.one;
    }
Example #8
0
    private void Awake()
    {
        BrPlayerTracker.Instance.OnPlayerDead += (victom, killer, weaponName) =>
        {
            BrPlayerTracker.Instance.OnLastPlayerLeft += player => gameObject.SetActive(false);

            if (BrPlayerTracker.Instance.PlayerCounter <= 1)
            {
                gameObject.SetActive(false);
                return;
            }

            if (victom.IsMaster)
            {
                rankText.text = "# " + BrPlayerTracker.Instance.PlayerCounter + 1;

                if (killer == null)
                {   // no killer
                    KillText.text = PersianFixer.Fix("شما کشته شدید");
                    OnReportNoKiller.Invoke();
                }
                else // has killer
                {
                    KillText.text = KillText.text
                                    .Replace("***", killer.profile.UserID)
                                    .Replace("###", weaponName);
                    CharacterModel.SetProfile(killer.profile);
                    OnReport.Invoke();
                }

                Director.Play();
            }
        };
    }
Example #9
0
    IEnumerator ChangeCoin(int newCount)
    {
        int cc = _coinCount;

        _step = (int)(Mathf.Abs(newCount - cc) / ChangeTextTime / 60);
        _step = Mathf.Max(_step, 1);
        if (cc < newCount)
        {
            while (cc + _step < newCount)
            {
                GetComponent <RectTransform>().localScale = _scale * Random.Range(0.8f, 1.2f);
                cc        += _step;
                _text.text = PersianFixer.Fix(cc.ToString("D"), false, true);
                yield return(new WaitForEndOfFrame());
            }
        }
        else
        {
            while (cc - _step > newCount)
            {
                GetComponent <RectTransform>().localScale = _scale * Random.Range(0.8f, 1.2f);
                cc        -= _step;
                _text.text = PersianFixer.Fix(cc.ToString("D"), false, true);
                yield return(new WaitForEndOfFrame());
            }
        }

        _text.text = PersianFixer.Fix(newCount.ToString("D"), false, true);
        GetComponent <RectTransform>().localScale = _scale;
        _coinCount = newCount;
        yield return(null);
    }
Example #10
0
 public void SetupHUD()
 {
     _clue = PersianFixer.Fix(WordSpawner.Clue);
     StartClueText.text  = _clue;
     HeaderClueText.text = _clue;
     HintClueText.text   = _clue;
     IndexText.text      = PersianFixer.Fix(WordSpawner.PuzzleRow);
 }
Example #11
0
 // Use this for initialization
 void Start()
 {
     _scale     = GetComponent <RectTransform>().localScale;
     _text      = GetComponent <Text>();
     _coinCount = PlayerController.PlayerInfo.CoinCount;
     _text.text = PersianFixer.Fix(_coinCount.ToString("D"), false, true);
     PurchaseManager.OnCurrencyChange.AddListener(SetCounter);
 }
Example #12
0
 private IEnumerator FixText()
 {
     while (true)
     {
         GetComponent <Text>().text = PersianFixer.Fix(TargetText.text);
         yield return(new WaitForSeconds(0.1f));
     }
 }
Example #13
0
    private void OnEnable()
    {
        string l =
            PersianFixer.Fix(
                BrExpManager.CalLevel(ProfileManager.Instance().PlayerProfile.PlayerStat.Experience)
                .ToString());

        GetComponent <Text>().text = GetComponent <Text>().text.Replace("*", l);
    }
Example #14
0
    public override void Refresh()
    {
        PlayingCategory   = CategoryWindow.SelectedCategory;
        CategoryName.text = PlayingCategory != null?PersianFixer.Fix(PlayingCategory.Name) : PersianFixer.Fix("جدول های اصلی");

        var puzzles = LocalDBController.Table <Puzzle>().SqlWhere(p => p.CategoryID == PlayingCategory.ID).ToList();

        puzzles.Sort((p1, p2) => p1.Row.CompareTo(p2.Row));
        UpdateItems(puzzles.Cast <object>());
    }
    private void ShowBuyItem(ProbType type, int index, int price)
    {
        string describe = PurchaseItemDescribe.Replace("****", PersianFixer.Fix(price.ToString()));
        string title    = PersianFixer.Fix("خرید");

        PreviewProb(type, index, title, describe);
        BuyButton.gameObject.SetActive(true);
        BuyButton.onClick.RemoveAllListeners();
        BuyButton.onClick.AddListener(() => BrStoreList.Instance.BuyItem(type, index, price));
        Description.gameObject.SetActive(true);
    }
Example #16
0
 public void SetCounter()
 {
     if (!gameObject.activeInHierarchy)
     {
         _coinCount = PlayerController.PlayerInfo.CoinCount;
         _text.text = PersianFixer.Fix(_coinCount.ToString("D"), false, true);
         return;
     }
     StopAllCoroutines();
     StartCoroutine(ChangeCoin(PlayerController.PlayerInfo.CoinCount));
 }
 void OnGUI()
 {
     Text = EditorGUILayout.TextField("Text ", Text);
     if (!string.IsNullOrEmpty(Text))
     {
         EditorGUILayout.LabelField("Fix text ", PersianFixer.Fix(Text));
     }
     if (GUILayout.Button("Copy"))
     {
         EditorGUIUtility.systemCopyBuffer = PersianFixer.Fix(Text);
     }
 }
    public IEnumerator ShowInviteRewardMessage(MgsDialougWindow window)
    {
        Debug.Log("hiiiiiiiiiiiiiiiii sjdlkjflksjdf");
        yield return(null);

        yield return(null);

        window.Message.text =
            window.Message.text.
            Replace("****", PersianFixer.Fix(InvitedUser)).
            Replace("***", RewartAmount.ToString("D"));
    }
Example #19
0
    public void InitializeButton(Sprite icon, int price, int itemCount, MarketItemType type, Action listAction)
    {
        ItemIcon.sprite = icon;

        string p = PersianFixer.Fix(price.ToString());

        ItemPrice.text = (type == MarketItemType.Coin?MarketPricePrefix:InGamePricePrefix) + " " + p;
        p = PersianFixer.Fix(itemCount.ToString());

        itemDescribe.text = (type == MarketItemType.Coin ? CoinDes : type == MarketItemType.Ticket ? TicketDes:"") + " " + p;
        itemDescribe.gameObject.SetActive(type != MarketItemType.Prob);

        GetComponent <Button>().onClick.RemoveAllListeners();
        GetComponent <Button>().onClick.AddListener(listAction.Invoke);
    }
Example #20
0
    public void SetVisual(TapsellNativeBannerAd nativeAd, Action getNative)
    {
        float range = Random.Range(0f, 1f);

        if (range > chance)
        {
            return;
        }

        gameObject.SetActive(true);

        if (Title != null)
        {
            Title.text = PersianFixer.Fix(nativeAd.getTitle(), true, true);
        }
        if (Description != null)
        {
            Description.text = PersianFixer.Fix(nativeAd.getDescription());
        }
        if (Content != null)
        {
            Content.text = PersianFixer.Fix(nativeAd.getCallToAction());
        }
        if (VerticalImage != null)
        {
            VerticalImage.sprite = TextureToSprite(nativeAd.getPortraitBannerImage());
        }
        if (HorizentalImage != null)
        {
            HorizentalImage.sprite = TextureToSprite(nativeAd.getLandscapeBannerImage());
        }
        if (Icon != null)
        {
            Icon.sprite = TextureToSprite(nativeAd.getIcon());
        }


        gameObject.SetActive(true);

        nativeAd.onShown();

        AdButton.onClick.RemoveAllListeners();
        AdButton.onClick.AddListener(() =>
        {
            getNative.Invoke();
            nativeAd.onClicked();
        });
    }
Example #21
0
/*
 *  public void ShowProb(Inventory inventory, bool battle)
 *  {
 *      ProbType probType = inventory.GetProb();
 *
 *      if (probType==ProbType.NoProb)
 *          return;
 *
 *      OnProbSelected(
 *          probType,
 *          inventory.Value,
 *          (battle&&ProfileManager.Instance().PlayerProfile.HasBattlePass==0));
 *  }
 *
 */

    public void PreviewProb(Inventory inventory, bool battle, int level)
    {
        ProbType probType = inventory.GetProb();

        if (probType == ProbType.NoProb)
        {
            return;
        }

        OnProbSelectednew(
            probType,
            inventory.Value,
            PersianFixer.Fix("جایزه سطح " + level.ToString()),
            "",
            battle && !ProfileManager.Instance().PlayerProfile.HasBattlePass);
    }
Example #22
0
    private void OnEnable()
    {
        SetSlider();


        if (rew)
        {
            return;
        }

        rew = true;

        for (var i = 0; i < RewardsList.LevelRewards.Count; i++)
        {
            LevelReward level = RewardsList.LevelRewards[i];
            foreach (Inventory reward in level.BattlePassReward)
            {
                var button = Instantiate(ButtonPrefab, BattlePassRewards, true);
                button.transform.localScale = Vector3.one;
                button.SetButton(reward, this, true, i + 1);
            }

            var o = Instantiate(Sectors, BattlePassRewards, true);
            o.transform.localScale = Vector3.one;
            o.GetComponentInChildren <Text>().text =
                o.GetComponentInChildren <Text>().
                text.Replace("*",
                             PersianFixer.Fix((i + 1).ToString()));

            foreach (Inventory reward in level.StandardReward)
            {
                var button = Instantiate(ButtonPrefab, StandardRewards, true);
                button.transform.localScale = Vector3.one;
                button.SetButton(reward, this, false, i + 1);
            }

            o = Instantiate(Sectors, StandardRewards, true);
            o.transform.localScale = Vector3.one;
            o.GetComponentInChildren <Text>().text =
                o.GetComponentInChildren <Text>().
                text.Replace("*", PersianFixer.Fix((i + 1).ToString()));
        }
        ScrollRect scrollRect = GetComponentInChildren <ScrollRect>();

        Debug.Log(scrollRect.horizontalNormalizedPosition);
        scrollRect.horizontalNormalizedPosition = sessionProgress;
    }
    public override void Refresh()
    {
        int?parentID = 3;

        if (SelectedCategory != null)
        {
            parentID = SelectedCategory?.ID;
        }


        var categories = LocalDBController.Table <Category>().SqlWhere(c => c.ParentID == parentID).ToList();

        categories.Sort((p1, p2) => p1.Row.CompareTo(p2.Row));
        CategoryName.text = SelectedCategory != null?PersianFixer.Fix(SelectedCategory.Name) : PersianFixer.Fix("جدول های اصلی");

        UpdateItems(categories.Cast <object>());
    }
    protected override void Refresh(object data)
    {
        _puzzle       = (Puzzle)data;
        ClueText.text =
            _puzzle.Paid ? PersianFixer.Fix(_puzzle.Clue) :
            ThemeManager.Instance.LanguagePack.GetLable("LockPuzzle");

        GetComponent <Image>().color = _puzzle.Paid ? OpenColor : LockColor;
        Row.gameObject.SetActive(_puzzle.Paid);
        LockIcon.gameObject.SetActive(!_puzzle.Paid);

        SolvedIcon.gameObject.SetActive(_puzzle.Solved);

        Row.text = PersianFixer.Fix((_puzzle.Row + 1).ToString(), true, true);

        GetComponent <RectTransform>().localScale = Vector3.one;
    }
    protected override void Refresh(object data)
    {
        _category = (Category)data;
        //_avalable = IsCategoryAvalable(category);

        Name.text = PersianFixer.Fix(_category.Name);
        NewIconGameObject.SetActive(!_category.Visit);

        _iconIndex  = int.Parse(_category.Icon);
        Icon.sprite = Sprites[_iconIndex];


        if (LocalDBController.Table <Category>().SqlWhere(c => c.ParentID == _category.ID).Any())
        {
            SubCategoryGameObject.SetActive(true);
            CheckMarckGameObject.SetActive(false);
            BuyGameObject.SetActive(false);
            CounterText.gameObject.SetActive(false);
            GetComponent <RectTransform>().localScale = Vector3.one;
            return;
        }

        SubCategoryGameObject.SetActive(false);

        var puzzles = LocalDBController.Table <Puzzle>().SqlWhere(p => p.CategoryID == _category.ID).ToList();

        var solveCount = puzzles.Count(p => p.Solved);

        BuyGameObject.SetActive(!IsCategoryAvalable());

        CheckMarckGameObject.SetActive(_category.Completed);
        CounterText.gameObject.SetActive(!_category.Completed);

        if (!IsCategoryAvalable())
        {
            CounterText.text = string.Format(PersianFixer.Fix("300", true, true));
        }
        else
        {
            CounterText.text =
                $"{PersianFixer.Fix(solveCount.ToString(), true, true)}/{PersianFixer.Fix(puzzles.Count.ToString(), true, true)}";
        }

        GetComponent <RectTransform>().localScale = Vector3.one;
    }
Example #26
0
    void OnGUI()
    {
        GUILayout.Label("Word Spawner", EditorStyles.boldLabel);

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Word Set");
        _wordSet = (WordSet)EditorGUILayout.ObjectField(_wordSet, typeof(WordSet), true);
        EditorGUILayout.EndHorizontal();

        if (!Wordspawner)
        {
            Wordspawner = FindObjectOfType <WordSpawner>();
        }

        if (_wordSet)
        {
            EditorGUILayout.LabelField("Word Set Clue : ", PersianFixer.Fix(_wordSet.Clue));
            EditorGUILayout.LabelField("Word Count : ", _wordSet.Words.Count.ToString());
            EditorGUILayout.LabelField("Nonunique Word Count : ", _wordSet.NonuniqWords.Count.ToString());

            EditorGUILayout.BeginHorizontal();
            _useJason = EditorGUILayout.Toggle("From Json ", _useJason);
            if (GUILayout.Button("Spawn"))
            {
                Wordspawner.EditorInstatiate = EditorInstantiate;
                Wordspawner.WordSet          = _useJason? ToJason(_wordSet):_wordSet;
                Wordspawner.SpawnWords();
            }
            if (GUILayout.Button("To Generatoe"))
            {
                string allWords = "";
                foreach (SWord word in _wordSet.Words)
                {
                    allWords += word.Name + " ";
                }

                FindObjectOfType <WordSetGenerator>().AllWords = allWords;
            }

            EditorGUILayout.EndHorizontal();
        }
    }
Example #27
0
    public override void Refresh()
    {
        var puzzle = PuzzleSelectionWindow.SelectedPuzzle;

        Clue.text = PersianFixer.Fix(puzzle.Clue);

        RegisterButton.interactable = puzzle.ServerID == null;
        ShareButton.interactable    = puzzle.ServerID != null;

        RateImage.gameObject.SetActive(puzzle.PlayCount != null);
        PlayCount.gameObject.SetActive(puzzle.PlayCount != null);

        if (puzzle.ServerID == null)
        {
            Description.text = ThemeManager.Instance.LanguagePack.GetLable("NotRegisterFull");
        }
        else if (puzzle.CategoryName == "")
        {
            Description.text = ThemeManager.Instance.LanguagePack.GetLable("InReviewFull");
            Description.text = Description.text.Replace("**-**", PersianFixer.Fix(puzzle.ServerID.ToString()));
        }
        else if (puzzle.CategoryName == "-")
        {
            Description.text = ThemeManager.Instance.LanguagePack.GetLable("NoCategoryFull");
            Description.text = Description.text.Replace("**-**", PersianFixer.Fix(puzzle.ServerID.ToString()));
        }
        if (puzzle.ServerID != null)
        {
            PlayCount.text = PersianFixer.Fix(puzzle.PlayCount + " نفر ", true, true);
            if (puzzle.Rate != null)
            {
                RateImage.fillAmount = puzzle.Rate.Value / 5f;
            }
            if (puzzle.CategoryName != null && puzzle.CategoryName.Length > 1)
            {
                Description.text = ThemeManager.Instance.LanguagePack.
                                   GetLable("UserPuzzleAcceptedFull").Replace("***", PersianFixer.Fix(puzzle.CategoryName));
                Description.text = Description.text.Replace("**-**", PersianFixer.Fix(puzzle.ServerID.ToString()));
            }
        }
    }
Example #28
0
    private void SetAdVisual()
    {
        if (Title != null)
        {
            Title.text = PersianFixer.Fix(_nativeAd.getTitle(), true, true);
        }
        if (Description != null)
        {
            Description.text = PersianFixer.Fix(_nativeAd.getDescription());
        }
        if (Content != null)
        {
            Content.text = PersianFixer.Fix(_nativeAd.getCallToAction());
        }

        if (VerticalImage != null)
        {
            VerticalImage.sprite = TextureToSprite(_nativeAd.getPortraitBannerImage());
        }
        if (HorizentalImage != null)
        {
            HorizentalImage.sprite = TextureToSprite(_nativeAd.getLandscapeBannerImage());
        }
        if (Icon != null)
        {
            Icon.sprite = TextureToSprite(_nativeAd.getIcon());
        }
        //BannerGameObject.transform.SetSiblingIndex(UnityEngine.Random.Range(0, 4));
        AdButton.gameObject.SetActive(true);
        _nativeAd.onShown();

        AdButton.onClick.RemoveAllListeners();
        AdButton.onClick.AddListener(() =>
        {
            //_unFocusTime = DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second;
            Invoke("GiveReward", 1f);
            _nativeAd.onClicked();
        });
    }
Example #29
0
    protected override void Refresh(object data)
    {
        _data = data;
        StoreItem storeItem = (StoreItem)_data;

        Icon.sprite    = storeItem.Icon;
        ItemTitle.text = storeItem.ItemTitle;
        bool hasItem = false;

        if (storeItem.IsVirtualGood)
        {
            hasItem = (StoreInventory.GetItemBalance(storeItem.ItemId) > 0);
        }

        HasItemIcon.gameObject.SetActive(hasItem);
        PriceText.gameObject.SetActive(!hasItem);
        GetComponent <Button>().interactable = !hasItem;
        int price = storeItem.Price;

        PriceText.text = PersianFixer.Fix(price > 0 ? " تومان " + price : "رایگان", true, true);
        GetComponent <RectTransform>().localScale = Vector3.one;
    }
 private void OnEnable() => GetComponent <Text>().text =
     PersianFixer.Fix(
         ProfileManager.Instance().PlayerProfile.TicketCount.ToString());