//-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- // return number < 0 if fails static int GetGoldCoinsCount(InAppProduct product, FundSettingsManager fundSettingsManager) { // method failed return code const int failed = -1; try { int fundGUID = GetFundGUID(product.ProductId); FundSettings fund = fundSettingsManager.FindByGUID(fundGUID); return(fund.AddGold); } catch { return(failed); } }
int CompareFund(int otherId) { FundSettings otherWs = FundSettingsManager.Instance.Get((E_FundID)(otherId)); FundSettings myWs = FundSettingsManager.Instance.Get((E_FundID)(Id)); int res; //convert currency displayed towards the end /*res = myWs.GoldCost.CompareTo(otherWs.GoldCost); * if(res != 0) * return res; * * res = myWs.MoneyCost.CompareTo(otherWs.MoneyCost); * if(res != 0) * return res;*/ //2. sort by how much money we get res = myWs.AddMoney.CompareTo(otherWs.AddMoney); if (res != 0) { return(res); } //3. sort by how much gold we get //free gold na konec goldu (protoze jej duplikujeme v zalozce FREE GOLD) res = FreeGoldType((E_FundID)Id).CompareTo(FreeGoldType((E_FundID)otherId)); if (res != 0) { return(res); } res = myWs.AddGold.CompareTo(otherWs.AddGold); if (res != 0) { return(res); } //Debug.Log("res " + res); return(res); }