Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     UserSingleton.GetInstance();
     UpgradeTabManager.GetInstance();
     heldDown      = false;
     holdDownTimer = 1.0f;
 }
 public EmployeeCatalog()
 {
     _serializer  = new Serialize();
     _currentUser = UserSingleton.GetInstance();
     EmployeeList = new List <Employee>();
     LoadEmployee();
 }
Esempio n. 3
0
    public void UpgradeSpeed()
    {
        Language          language      = null;
        DialogDataConfirm dialogConfirm = null;

        language = Language.GetInstance();

        dialogConfirm = new DialogDataConfirm
                        (
            language.GetLanguage("Speed Upgrade Confirm"),
            string.Format
            (
                language.GetLanguage("Diamonds are required"),
                UserSingleton.GetInstance().m_nSpeedLevel * 2
            ),
            delegate(bool isYes) { if (isYes)
                                   {
                                       Upgrade("Speed");
                                   }
            }
                        );

        m_objConfirmDialog.SetActive(true);

        DialogManager.GetInstance().Push(dialogConfirm);
    }
Esempio n. 4
0
    private void FacebookLoginCheck(ILoginResult loginResult)
    {
        bool          isLoginResult = false;
        JSONObject    objResult     = null;
        UserSingleton userSingleton = null;

        objResult     = JSONObject.Parse(loginResult.RawResult);
        userSingleton = UserSingleton.GetInstance();

        userSingleton.m_strFacebookID          = objResult["user_id"].Str;
        userSingleton.m_strFacebookPhotoURL    = "http://graph.facebook.com/";
        userSingleton.m_strFacebookPhotoURL   += userSingleton.m_strFacebookID;
        userSingleton.m_strFacebookPhotoURL   += "/picture?type=square";
        userSingleton.m_strFacebookAccessToken = objResult["access_token"].Str;

        isLoginResult = (userSingleton.m_strFacebookID != null);

        Debug.Log("Facebook Login Result : " + loginResult.RawResult);

        if (userSingleton.m_strFacebookID != null)
        {
            LoadData(isLoginResult);
        }
        else
        {
            Debug.LogError("로그인 실패..");
        }
    }
Esempio n. 5
0
    void ReadHeroStats()
    {
        string     sqlQuery = "SELECT attack,upgradeLevel, price,previousPrice,attackTime,name " + "FROM UnitsData ";
        IDbCommand dbcmd    = dbconn.CreateCommand();

        dbcmd.CommandText = sqlQuery;
        IDataReader reader = dbcmd.ExecuteReader();

        for (int i = 0; i < numberOfHeros; ++i)
        {
            if (reader.Read())
            {
                int    attack        = reader.GetInt32(0);
                int    upgradeLevel  = reader.GetInt32(1);
                int    price         = reader.GetInt32(2);
                int    previousPrice = reader.GetInt32(3);
                int    attackTime    = reader.GetInt32(4);
                string heroName      = reader.GetString(5);
                UserSingleton.GetInstance().CreateHero(attack, upgradeLevel, price, previousPrice, attackTime, heroName);
            }
        }
        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
    }
Esempio n. 6
0
    //DragDetect dragDetect;
    //int currentTabIndex;
    //public float tabMoved;
    //public float TabIndexFloat;
    public UpgradeTabManager()
    {
        //TabIndexFloat = 0;
        //currentTabIndex = 0;
        /******Init options***/
        UserSingleton.GetInstance().Options.AddComponent <Mask>();
        Options      = new GameObject();
        Options.name = "UpgradeTabs";
        Options.transform.SetParent(UserSingleton.GetInstance().Options.transform);
        Options.transform.SetAsFirstSibling();
        Options.transform.localPosition = new Vector3(0, UserSingleton.GetInstance().Options.GetComponent <RectTransform>().rect.height / 2, 0);
        Options.transform.localScale    = new Vector3(1, 1, 1);
        Options.AddComponent <RectTransform>();
        Options.GetComponent <RectTransform>().sizeDelta = new Vector2(UserSingleton.GetInstance().Options.GetComponent <RectTransform>().rect.width, UserSingleton.GetInstance().Options.GetComponent <RectTransform>().rect.height);
        //Options.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f,1.0f);
        //Options.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 1.0f);
        Options.AddComponent <BoxCollider>();
        Options.GetComponent <BoxCollider>().size      = new Vector3(Options.GetComponent <RectTransform>().rect.width, Options.GetComponent <RectTransform>().rect.height, 1);
        Options.GetComponent <BoxCollider>().isTrigger = true;
        UserSingleton.GetInstance().Options.AddComponent <ScrollRect>();
        UserSingleton.GetInstance().Options.GetComponent <ScrollRect>().content           = Options.GetComponent <RectTransform>();
        UserSingleton.GetInstance().Options.GetComponent <ScrollRect>().horizontal        = false;
        UserSingleton.GetInstance().Options.GetComponent <ScrollRect>().scrollSensitivity = 10;
        //Options.AddComponent<DragDetect>();
        //dragDetect = Options.GetComponent<DragDetect>();

        /******UpgradetabPrefab****/
        UpgradeTabPrefab  = Resources.Load("Prefabs/UpgradeCharacterTab") as GameObject;
        UpgradeTabUnitPos = (Options.GetComponent <RectTransform>().rect.height / 4);
    }
Esempio n. 7
0
    void SaveHerosData()
    {
        string     sqlQuery = "delete from " + "UnitsData";
        IDbCommand dbcmd    = dbconn.CreateCommand();

        dbcmd.CommandText = sqlQuery;
        IDataReader reader = dbcmd.ExecuteReader();

        for (int i = 0; i < UserSingleton.GetInstance().heroList.Count; ++i)
        {
            sqlQuery = "INSERT INTO UnitsData (attack,upgradeLevel,price,previousPrice,attackTime,name,type) VALUES ("
                       + UserSingleton.GetInstance().heroList[i].attack.ToString() + ", "
                       + UserSingleton.GetInstance().heroList[i].upgradeLevel.ToString() + ", "
                       + UserSingleton.GetInstance().heroList[i].price.ToString() + ", "
                       + UserSingleton.GetInstance().heroList[i].previousPrice.ToString() + ", "
                       + "1" + ", "
                       + "'" + UserSingleton.GetInstance().heroList[i].name + "'" + ", "
                       + "1" + ") ";
            reader.Close();
            reader            = null;
            dbcmd.CommandText = sqlQuery;
            reader            = dbcmd.ExecuteReader();
        }
        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
    }
Esempio n. 8
0
    private void Awake()
    {
        m_refInstance    = this;
        m_audioSource    = GetComponent <AudioSource>();
        m_arrDashSound   = new string[3];
        m_arrSkillSound  = new string[6];
        m_arrNormalSound = new string[6];

        m_arrDashSound[0] = "VoiceSample/10.attack_A1";
        m_arrDashSound[1] = "VoiceSample/11.attack_A2";
        m_arrDashSound[2] = "VoiceSample/12.attack_A3";

        m_arrSkillSound[0] = "VoiceSample/44.special_attack_X1";
        m_arrSkillSound[1] = "VoiceSample/45.special_attack_X2";
        m_arrSkillSound[2] = "VoiceSample/46.special_attack_X3";
        m_arrSkillSound[3] = "VoiceSample/47.special_attack_X4";
        m_arrSkillSound[4] = "VoiceSample/48.special_attack_X5";
        m_arrSkillSound[5] = "VoiceSample/50.special_attack_X7";

        m_arrNormalSound[0] = "VoiceSample/13.attack_B1";
        m_arrNormalSound[1] = "VoiceSample/14.attack_B2";
        m_arrNormalSound[2] = "VoiceSample/15.attack_B3";
        m_arrNormalSound[3] = "VoiceSample/16.attack_C1";
        m_arrNormalSound[4] = "VoiceSample/17.attack_C2";
        m_arrNormalSound[5] = "VoiceSample/18.attack_C3";

        m_nNormalDamage = UserSingleton.GetInstance().m_nDamage;
        m_nDashDamage   = m_nNormalDamage * 2;
        m_nSkillDamage  = m_nNormalDamage * 4;
    }
Esempio n. 9
0
 public override void UpgradeStats()
 {
     if (UserSingleton.GetInstance().gold - price >= 0)
     {
         attack += (int)(0.5f * UserSingleton.GetInstance().currentStage);
         UserSingleton.GetInstance().AddGold(-price);
         price += (int)(price * 1.25f);
     }
 }
Esempio n. 10
0
 public override void attackEnemy()
 {
     attackTime -= Time.deltaTime;
     if (attackTime <= 0 && UserSingleton.GetInstance().mainHero != this)
     {
         attackTime = attackTimeConst;
         Attack();
     }
 }
Esempio n. 11
0
 public virtual void SpecialSkill()
 {
     if (specialAttackAvaliable == false)
     {
         anim.Play("SpecialAttack", 0, 0.0f);
         anim.SetInteger("State", 2);
         UserSingleton.GetInstance().enemy.TakeDamage(attack * 100);
         UseSpecial();
     }
 }
Esempio n. 12
0
 void OnMouseUp()
 {
     if (heldDown == true)
     {
         heldDown      = false;
         holdDownTimer = 1.0f;
         Debug.Log("Attack click");
         UserSingleton.GetInstance().mainHero.Attack();
     }
 }
Esempio n. 13
0
    private void Awake()
    {
        Screen.SetResolution(1280, 720, true);

        RankCellPool.Create("Prefab/RankCell", "RankCellPool", 50, 2);

        m_objRankContent.SetActive(false);

        UserSingleton.GetInstance().Refresh(delegate() { });
    }
Esempio n. 14
0
    // Start is called before the first frame update
    private void Awake()
    {
        m_animPlayer     = GetComponent <Animator>();
        m_audioPlayer    = GetComponent <AudioSource>();
        m_movementPlayer = GetComponent <PlayerMovement>();
        m_nCurrentHealth = UserSingleton.GetInstance().m_nHealth;

        m_silderHealth.value    = m_nCurrentHealth;
        m_silderHealth.maxValue = m_nCurrentHealth;
    }
Esempio n. 15
0
    // 추후 if문을 없애고 보다 효율적으로 개선해야함.
    private void UpgradeDelegate(WWW www)
    {
        if (www.text == "")
        {
            Debug.Log("서버에서 업그레이드 정보를 전달하는 중 문제가 발생했습니다.");
            return;
        }

        int             nResultCode = 0;
        JSONObject      jsonResult  = null;
        DialogDataAlert dialogAlert = null;

        jsonResult  = JSONObject.Parse(www.text);
        nResultCode = (int)jsonResult["ResultCode"].Number;

        if (nResultCode == 1) // Success_Code
        {
            UserSingleton.GetInstance().Refresh
            (
                delegate()
            {
                NotificationCenter.GetInstance().Notify(NotificationCenter.E_SUBJECT.E_PLAYER_DATA);
            }
            );

            dialogAlert = new DialogDataAlert
                          (
                Language.GetInstance().GetLanguage("Upgrade Success"),
                Language.GetInstance().GetLanguage("Success"),
                delegate() { }
                          );
        }
        else if (nResultCode == 4) // Player_is_MaxLevel
        {
            dialogAlert = new DialogDataAlert
                          (
                Language.GetInstance().GetLanguage("Upgrade Failed"),
                Language.GetInstance().GetLanguage("Max Level"),
                delegate() { }
                          );
        }
        else if (nResultCode == 5) // Not_Enough_Diamond
        {
            dialogAlert = new DialogDataAlert
                          (
                Language.GetInstance().GetLanguage("Upgrade Failed"),
                Language.GetInstance().GetLanguage("Not Enough Diamond"),
                delegate() { }
                          );
        }

        m_objAlertDialog.SetActive(true);

        DialogManager.GetInstance().Push(dialogAlert);
    }
Esempio n. 16
0
 public virtual void UpgradeStats()
 {
     Debug.Log("UpgradeStatsRan");
     if (UserSingleton.GetInstance().gold - price > 0)
     {
         Debug.Log("UpgradeStatsAddStats");
         attack += (int)(0.5f * UserSingleton.GetInstance().currentStage);
         UserSingleton.GetInstance().gold -= price;
         price += (int)(price * 0.7f);
     }
 }
Esempio n. 17
0
 public NavigationHelperVm()
 {
     CurrentUser      = UserSingleton.GetInstance();
     TaskSingleton    = TaskEquipmentStationSingleton.GetInstance();
     _frameNavigation = new FrameNavigateClass();
     GoTask           = new RelayCommandClass(DoTask);
     GoDone           = new RelayCommandClass(DoDone);
     DoGoCreate       = new RelayCommandClass(GoCreate);
     UserName         = CurrentUser.GetUsername();
     UserId           = CurrentUser.GetUserID();
 }
Esempio n. 18
0
 public override void SpecialSkill()
 {
     Debug.Log("SPECIAL ATTACK");
     if (specialAttackAvaliable == true)
     {
         anim.Play("SpecialAttack", 0, 0.0f);
         //anim.SetInteger("State", 2);
         UserSingleton.GetInstance().enemy.TakeDamage(attack * 100);
         UseSpecial();
     }
 }
Esempio n. 19
0
    public void UpdatePlayerData()
    {
        UserSingleton userSingleton = UserSingleton.GetInstance();

        m_textName.text    = userSingleton.m_strName;
        m_textLevel.text   = "Lv. " + userSingleton.m_nLevel.ToString();
        m_textExp.text     = userSingleton.m_nExpAfterLastLevel.ToString() + '/' + userSingleton.m_nExpForNextLevel.ToString();
        m_textDiamond.text = userSingleton.m_nDiamond.ToString();

        m_sliderExp.maxValue = userSingleton.m_nExpForNextLevel;
        m_sliderExp.value    = userSingleton.m_nExpAfterLastLevel;
    }
Esempio n. 20
0
    private void LoadFacebookDataFriend()
    {
        UserSingleton.GetInstance().LoadFacebookFriend
        (
            delegate(bool isSuccess, string strResponse)
        {
            m_nNowLoadingStage++;

            Debug.Log("페이스북 내 친구 정보 로드 결과 : " + strResponse);
        }
        );
    }
Esempio n. 21
0
 // Update is called once per frame
 void Update()
 {
     //UpgradeTabManager.GetInstance().DragResponse();
     if (heldDown == true)
     {
         holdDownTimer -= Time.deltaTime;
         if (holdDownTimer <= 0)
         {
             Debug.Log("SPECIAL");
             holdDownTimer = 1.0f;
             heldDown      = false;
             UserSingleton.GetInstance().mainHero.SpecialSkill();
         }
     }
 }
Esempio n. 22
0
    void SavePlayerStats()
    {
        IDbCommand dbcmd    = dbconn.CreateCommand();
        string     sqlQuery = "UPDATE User SET gold = " + UserSingleton.GetInstance().gold.ToString() +
                              ", stageNumber = " + UserSingleton.GetInstance().currentStage.ToString() +
                              ", numberOfHeros = " + UserSingleton.GetInstance().heroList.Count.ToString() +
                              " WHERE name = 'user'";

        dbcmd.CommandText = sqlQuery;
        IDataReader reader = dbcmd.ExecuteReader();

        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
    }
Esempio n. 23
0
    void SaveEnemyData()
    {
        IDbCommand dbcmd    = dbconn.CreateCommand();
        string     sqlQuery = "UPDATE EnemyStats SET MaxHealth = " + UserSingleton.GetInstance().enemy.Max_Health.ToString() +
                              ", LootGold = " + UserSingleton.GetInstance().enemy.lootGold.ToString() +
                              ", MobType = " + ((int)UserSingleton.GetInstance().enemy.mobType).ToString() +
                              " WHERE name = 'user'";

        dbcmd.CommandText = sqlQuery;
        IDataReader reader = dbcmd.ExecuteReader();

        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
    }
Esempio n. 24
0
 public void TakeDamage(int dmg)
 {
     if (markDead)
     {
         return;
     }
     health -= dmg;
     if (health <= 0)
     {
         health = 0;
         //dead here
         lootGold += (int)(lootGold * 0.2f);
         goldText.SetActive(true);
         goldText.GetComponent <Text>().text = lootGold.ToString() + " Gold";
         goldText.GetComponent <Animator>().Play("DamageText", 0, 0);
         UserSingleton.GetInstance().AddGold(lootGold);
         UserSingleton.GetInstance().NextStage();
         anim.Play("Dead", 0, 0.0f);
         anim.SetInteger("State", 2);
         markDead = true;
     }
     else
     {
         anim.Play("Hurt", 0, 0.0f);
         anim.SetInteger("State", 1);
     }
     if (damageTextIndex >= damageText.Length)
     {
         damageTextIndex = 0;
     }
     damageText[damageTextIndex].SetActive(true);
     damageText[damageTextIndex].GetComponent <Text>().text = dmg.ToString();
     damageText[damageTextIndex].GetComponent <Animator>().Play("DamageText", 0, 0);
     if (dmg > (int)(health * 0.1f))
     {
         damageText[damageTextIndex].GetComponent <Text>().color = new Color(1, 0, 0);
         damageText[damageTextIndex].transform.localScale        = new Vector3(2, 2, 2);
     }
     else if (damageText[damageTextIndex].transform.localScale.x != 1)//if the image is not scalled correctly its color will be wrong (for now)
     {
         damageText[damageTextIndex].GetComponent <Text>().color = new Color(1, 1, 1);
         damageText[damageTextIndex].transform.localScale        = new Vector3(1, 1, 1);
     }
     ++damageTextIndex;
     //Update the health bar fill amount
     UpdateHealthBar();
 }
Esempio n. 25
0
    private void LoginServer()
    {
        string     strDomain = "";
        JSONObject jsonBody  = null;

        jsonBody  = new JSONObject();
        strDomain = UserSingleton.GetInstance().GetServerDomain() + "/Login/Facebook";

        jsonBody.Add("FacebookID", UserSingleton.GetInstance().m_strFacebookID);
        jsonBody.Add("FacebookAccessToken", UserSingleton.GetInstance().m_strFacebookAccessToken);
        jsonBody.Add("FacebookName", UserSingleton.GetInstance().m_strName);
        jsonBody.Add("FacebookPhotoURL", UserSingleton.GetInstance().m_strFacebookPhotoURL);

        Debug.Log("서버에 전달 할 값 : " + jsonBody.ToString());

        HTTPClient.GetInstance().POST(strDomain, jsonBody.ToString(), ServerLoginCheck);
    }
Esempio n. 26
0
    public void Upgrade(string strUpgradeType)
    {
        JSONObject    jsonUser      = null;
        HTTPClient    client        = null;
        UserSingleton userSingleton = null;

        client        = HTTPClient.GetInstance();
        jsonUser      = new JSONObject();
        userSingleton = UserSingleton.GetInstance();

        jsonUser.Add("UserID", userSingleton.m_nUserID);
        jsonUser.Add("UpgradeType", strUpgradeType);

        Debug.Log("jsonUser : "******"/Upgrade/Execute", jsonUser.ToString(), UpgradeDelegate);
    }
Esempio n. 27
0
    private void UpdatePlayerData()
    {
        UserSingleton userSingleton = UserSingleton.GetInstance();

        m_textUpgradeStatus.text = string.Format
                                   (
            "PlayerStatus\n\nHealth : {0}\nDefense : {1}\nDamage : {2}\nSpeed : {3}",
            userSingleton.m_nHealth,
            userSingleton.m_nDefense,
            userSingleton.m_nDamage,
            userSingleton.m_nSpeed
                                   );

        m_textSpeed.text   = string.Format("Lv. {0}", userSingleton.m_nSpeedLevel);
        m_textHealth.text  = string.Format("Lv. {0}", userSingleton.m_nHealthLevel);
        m_textDamage.text  = string.Format("Lv. {0}", userSingleton.m_nDamageLevel);
        m_textDefense.text = string.Format("Lv. {0}", userSingleton.m_nDefenseLevel);
    }
Esempio n. 28
0
    private void LoginInit()
    {
        bool isUserIDNotZero   = false;
        bool isGainAccessToken = false;

        isUserIDNotZero   = UserSingleton.GetInstance().m_nUserID != 0;
        isGainAccessToken = UserSingleton.GetInstance().m_strAccessToken != "";

        RankSingleton.Create();

        if (isUserIDNotZero && isGainAccessToken)
        {
            LoginFacebook();
        }
        else
        {
            m_objFacebookButton.SetActive(true);
        }
    }
Esempio n. 29
0
    private void ServerLoginCheck(WWW www)
    {
        if (www.text.Length == 0)
        {
            Debug.LogError("서버 로그인 정보 값이 전달 되지 않았습니다..");

            return;
        }

        int        nResultCode  = 0;
        JSONObject jsonResponse = null;

        jsonResponse = JSONObject.Parse(www.text);
        nResultCode  = (int)jsonResponse["ResultCode"].Number;

        Debug.Log(www.text);

        if (nResultCode == 1 || nResultCode == 2)
        {
            string     strIDCode = "";
            JSONObject jsonData  = null;

            jsonData  = jsonResponse.GetObject("Data");
            strIDCode = nResultCode == 1 ? "새로 가입하는 ID입니다!" : "이미 존재하는 ID입니다!";

            UserSingleton.GetInstance().m_nUserID        = int.Parse(jsonData["UserID"].Number.ToString());
            UserSingleton.GetInstance().m_strAccessToken = jsonData["AccessToken"].Str;

            Debug.Log("현재 접속한 ID는 " + strIDCode);
            Debug.Log("ID : " + UserSingleton.GetInstance().m_nUserID.ToString());
            Debug.Log("AccessToken : " + UserSingleton.GetInstance().m_strAccessToken);
            Debug.Log("서버 로그인 성공!");

            InvokeRepeating("LoadDataFromGameServer", 0.01f, 0.2f);
        }
        else
        {
            Debug.LogError("로그인에 실패했습니다..");

            return;
        }
    }
Esempio n. 30
0
 public void InitPosition()
 {
     if (UserSingleton.GetInstance().mainHero == this)
     {
         Debug.Log("RAN");
         this.SetToMain();
     }
     else
     {
         for (int i = 0; i < UserSingleton.GetInstance().heroList.Count; ++i)
         {
             if (UserSingleton.GetInstance().heroList[i] == this)
             {
                 PutToSideLines(i - 1);
                 Debug.Log("RAN2");
                 return;
             }
         }
     }
 }