Exemplo n.º 1
0
 public Gem(GemType t, int l, Vector2 p)
 {
     layer = l;
     position = p;
     type = t;
     collected = false;
 }
Exemplo n.º 2
0
 public GemInfo GetGemInfo(GemType type)
 {
     foreach(var info in gemInfo) {
         if(info.type == type) {
             return info;
         }
     }
     return null;
 }
Exemplo n.º 3
0
 static int FindGemsOfType(GemType type, int[] adjustedSpin, List<GemLocation> gems)
 {
     var counter = 0;
     foreach(var gl in gems) {
         if(gl.type == type && gl.idx == adjustedSpin[gl.reel]) {
             counter++;
         }
     }
     return counter;
 }
Exemplo n.º 4
0
        public BaseJewel( int itemID, Layer layer )
            : base(itemID)
        {
            m_AosAttributes = new AosAttributes( this );
            m_AosResistances = new AosElementAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_Resource = CraftResource.Iron;
            m_GemType = GemType.None;

            Layer = layer;
        }
Exemplo n.º 5
0
    public GameObject CreateGem(GemType type)
    {
        var info = GetGemInfo(type);
        var toReturn = new GameObject(info.name);
        var mf = toReturn.AddComponent<MeshFilter>();
        mf.mesh = baseMesh;
        var mr = toReturn.AddComponent<MeshRenderer>();
        mr.material = info.material;
        toReturn.transform.localScale = info.scale;

        return toReturn;
    }
Exemplo n.º 6
0
        public BaseJewel( int itemID, Layer layer )
            : base(itemID)
        {
            m_AosAttributes = new AosAttributes( this );
            m_AosResistances = new AosElementAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_Resource = CraftResource.Iron;
            m_GemType = GemType.None;

            Layer = layer;

            m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits );
        }
Exemplo n.º 7
0
		public static string GetGemType( GemType type )
		{
			switch (type)
			{
				case GemType.StarSapphire: return "star sapphire";
				case GemType.Emerald: return "emerald";
				case GemType.Sapphire: return "sapphire";
				case GemType.Ruby: return "ruby";
				case GemType.Citrine: return "citrine";
				case GemType.Amethyst: return "amethyst";
				case GemType.Tourmaline: return "tourmaline";
				case GemType.Amber: return "amber";
				case GemType.Diamond: return "diamond";
				default: return "";
			}
		}
Exemplo n.º 8
0
        public BaseJewel(int itemID, Layer layer, JewelEffect effect, int minCharges, int maxCharges)
            : base(itemID)
        {
            m_AosAttributes = new AosAttributes( this );
            m_AosResistances = new AosElementAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_Resource = CraftResource.Iron;
            m_GemType = GemType.None;
            m_IDList = new List<Mobile>();

            Layer = layer;
            Weight = 1.0;
            Effect = effect;
            Charges = Utility.RandomMinMax( minCharges, maxCharges );
            m_Identified = false;
        }
Exemplo n.º 9
0
        public void AddJewelrySet( GemType gemType, Type itemType )
        {
            int offset = (int)gemType - 1;

            int index = AddCraft( typeof( GoldRing ), 1044049, 1044176 + offset, 41.8, 90.0, typeof( IronIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( SilverBeadNecklace ), 1044049, 1044185 + offset, 42.0, 90.0, typeof( IronIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( GoldNecklace ), 1044049, 1044194 + offset, 41.9, 90.0, typeof( IronIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( GoldEarrings ), 1044049, 1044203 + offset, 48.4, 90.0, typeof( IronIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( GoldBeadNecklace ), 1044049, 1044212 + offset, 41.8, 90.0, typeof( IronIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( GoldBracelet ), 1044049, 1044221 + offset, 44.5, 90.0, typeof( IronIngot ), 1044036, 2, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );
        }
Exemplo n.º 10
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 3:
				{
					m_MaxHitPoints = reader.ReadEncodedInt();
					m_HitPoints = reader.ReadEncodedInt();

					goto case 2;
				}
				case 2:
				{
					m_Resource = (CraftResource)reader.ReadEncodedInt();
					m_GemType = (GemType)reader.ReadEncodedInt();

					goto case 1;
				}
				case 1:
				{
					break;
				}
				case 0:
				{
					break;
				}
			}

			if ( version < 2 )
			{
				m_Resource = CraftResource.Iron;
				m_GemType = GemType.None;
			}
		}
Exemplo n.º 11
0
 public static void AddFlag(this GemType self, GemType other, out GemType result)
 {
     result = self | other;
 }
Exemplo n.º 12
0
 public static void ToogleFlag(this GemType self, GemType other, out GemType result)
 {
     result = self ^ other;
 }
Exemplo n.º 13
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 11:
            {
                m_SetPhysicalBonus = reader.ReadInt();
                m_SetFireBonus     = reader.ReadInt();
                m_SetColdBonus     = reader.ReadInt();
                m_SetPoisonBonus   = reader.ReadInt();
                m_SetEnergyBonus   = reader.ReadInt();
                goto case 10;
            }

            case 10:
            {
                m_PlayerConstructed = reader.ReadBool();
                goto case 9;
            }

            case 9:
            {
                m_TalismanProtection = new TalismanAttribute(reader);
                goto case 8;
            }

            case 8:
            {
                _VvVItem   = reader.ReadBool();
                _Owner     = reader.ReadMobile();
                _OwnerName = reader.ReadString();
                goto case 7;
            }

            case 7:
            {
                m_IsImbued = reader.ReadBool();
                goto case 6;
            }

            case 6:
            {
                m_NegativeAttributes = new NegativeAttributes(this, reader);
                goto case 5;
            }

            case 5:
            {
                #region Runic Reforging
                m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt();
                m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt();
                m_ItemPower      = (ItemPower)reader.ReadInt();
                m_BlockRepair    = reader.ReadBool();
                #endregion

                #region Stygian Abyss
                m_GorgonLenseCharges = reader.ReadInt();
                m_GorgonLenseType    = (LenseType)reader.ReadInt();
                goto case 4;
            }

            case 4:
            {
                m_TimesImbued = reader.ReadEncodedInt();

                m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
                #endregion

                m_BlessedBy    = reader.ReadMobile();
                m_LastEquipped = reader.ReadBool();
                m_SetEquipped  = reader.ReadBool();
                m_SetHue       = reader.ReadEncodedInt();

                m_SetAttributes   = new AosAttributes(this, reader);
                m_SetSkillBonuses = new AosSkillBonuses(this, reader);

                m_Crafter = reader.ReadMobile();
                m_Quality = (ItemQuality)reader.ReadInt();
                goto case 3;
            }

            case 3:
            {
                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 2;
            }

            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                if (Core.AOS && Parent is Mobile)
                {
                    m_AosSkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_AosAttributes.BonusStr;
                int dexBonus = m_AosAttributes.BonusDex;
                int intBonus = m_AosAttributes.BonusInt;

                if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
                {
                    Mobile m = (Mobile)Parent;

                    string modName = Serial.ToString();

                    if (strBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
                    }

                    if (dexBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
                    }

                    if (intBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
                    }
                }

                if (Parent is Mobile)
                {
                    ((Mobile)Parent).CheckStatTimers();
                }

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);

                break;
            }
            }

            if (m_NegativeAttributes == null)
            {
                m_NegativeAttributes = new NegativeAttributes(this);
            }

            if (m_TalismanProtection == null)
            {
                m_TalismanProtection = new TalismanAttribute();
            }

            #region Mondain's Legacy Sets
            if (m_SetAttributes == null)
            {
                m_SetAttributes = new AosAttributes(this);
            }

            if (m_SetSkillBonuses == null)
            {
                m_SetSkillBonuses = new AosSkillBonuses(this);
            }
            #endregion

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
        public static async Task<ShareStatusAndCommentsCount> GetShareStatusAndCommentsCount(string gemId, GemType gemtype, string userId)
        {
            try
            {
                if (!CrossConnectivity.Current.IsConnected)
                {
                    return null;
                }

                var client = new System.Net.Http.HttpClient();
                client.DefaultRequestHeaders.Add("Post", "application/json");
                client.BaseAddress = new Uri(Constants.SERVICE_BASE_URL);
                string gemIdString = string.Empty;

                switch (gemtype)
                {
                    case GemType.Goal:
                        gemIdString = "&goal_id=";
                        break;
                    case GemType.Event:
                        gemIdString = "&event_id=";
                        break;
                    case GemType.Action:
                        gemIdString = "&goalaction_id=";
                        break;
                    case GemType.Emotion:
                        gemIdString = "&emotion_id=";
                        break;
                    default:
                        break;
                }

                string uriString = "api.php?action=sharestatus&user_id=" +userId+ gemIdString + gemId;

                var response = await client.GetAsync(uriString);

                if (response != null && response.StatusCode == HttpStatusCode.OK)
                {
                    var responseJson = response.Content.ReadAsStringAsync().Result;
                    var rootobject = JsonConvert.DeserializeObject<ShareStatusResult>(responseJson);
                    if (rootobject != null && rootobject.resultarray != null)
                    {
                        return rootobject.resultarray;
                    }
                }

            }
            catch (Exception ex)
            {
                var test = ex.Message;
            }

            return null;
        }
Exemplo n.º 15
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 7:
                    {
                        m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
                        goto case 6;
                    }
				case 6:
				{
                        if (version == 6)
                            m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);

					m_MaxHitPoints = reader.ReadEncodedInt();
					m_HitPoints = reader.ReadEncodedInt();

					goto case 5;
				}
				//personal bless deed
				case 5:
				{
					m_BlessedBy = reader.ReadMobile();
					goto case 4;
				}
				#region Mondain's Legacy Sets
				case 4:
				{
					m_LastEquipped = reader.ReadBool();
					m_SetEquipped = reader.ReadBool();
					m_SetHue = reader.ReadEncodedInt();

					m_SetAttributes = new AosAttributes( this, reader );
					m_SetSkillBonuses = new AosSkillBonuses( this, reader );

					goto case 3;
				}
				#endregion
				#region Mondain's Legacy
				case 3:
				{
					m_Crafter = reader.ReadMobile();
					m_Quality = (ArmorQuality) reader.ReadInt();
										
					goto case 2;
				}
				#endregion
				case 2:
				{
					m_Resource = (CraftResource)reader.ReadEncodedInt();
					m_GemType = (GemType)reader.ReadEncodedInt();

					goto case 1;
				}
				case 1:
				{
					m_AosAttributes = new AosAttributes( this, reader );
					m_AosResistances = new AosElementAttributes( this, reader );
					m_AosSkillBonuses = new AosSkillBonuses( this, reader );

					if ( Core.AOS && Parent is Mobile )
						m_AosSkillBonuses.AddTo( (Mobile)Parent );

					int strBonus = m_AosAttributes.BonusStr;
					int dexBonus = m_AosAttributes.BonusDex;
					int intBonus = m_AosAttributes.BonusInt;

					if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
					{
						Mobile m = (Mobile)Parent;

						string modName = Serial.ToString();

						if ( strBonus != 0 )
							m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

						if ( dexBonus != 0 )
							m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

						if ( intBonus != 0 )
							m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
					}

					if ( Parent is Mobile )
						((Mobile)Parent).CheckStatTimers();

					break;
				}
				case 0:
				{
					m_AosAttributes = new AosAttributes( this );
					m_AosResistances = new AosElementAttributes( this );
					m_AosSkillBonuses = new AosSkillBonuses( this );

					break;
				}
			}

			#region Mondain's Legacy Sets
			if ( m_SetAttributes == null )
				m_SetAttributes = new AosAttributes( this );

			if ( m_SetSkillBonuses == null )
				m_SetSkillBonuses = new AosSkillBonuses( this );
			#endregion

			if ( version < 2 )
			{
				m_Resource = CraftResource.Iron;
				m_GemType = GemType.None;
			}
		}
        public AddEventsSituationsOrThoughts(string title, DetailsPageModel detailsPageModel = null)
        {
            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            audioRecorder = DependencyService.Get<PurposeColor.interfaces.IAudioRecorder>();
            //deviceSpec = DependencyService.Get<IDeviceSpec>();
            screenHeight = App.screenHeight;
            screenWidth = App.screenWidth;

            masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            pageTitle = title;
            lattitude = string.Empty;
            longitude = string.Empty;
            currentAddress = string.Empty;
            int devWidth = (int)screenWidth;
            App.MediaArray = new List<MediaItem>();
            App.ContactsArray = new List<string>();
            App.PreviewListSource.Clear();
            int textInputWidth = (int)(devWidth * .80);
			contactSelectAction = OnContactSelected;

            #region TITLE BARS
            TopTitleBar = new StackLayout
            {
                BackgroundColor = Constants.BLUE_BG_COLOR,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.StartAndExpand,
                Padding = 0,
                Spacing = 0,
                Children = { new BoxView { WidthRequest = screenWidth } }
            };
            masterLayout.AddChildToLayout(TopTitleBar, 0, 0);
            
            string trimmedPageTitle = string.Empty;

            int titleMaxLength = 24;
            if (App.screenDensity > 1.5)
            {
                titleMaxLength = 24;
            }
            else
            {
                titleMaxLength = 22;
            }

            if (title.Length > titleMaxLength)
            {
                trimmedPageTitle = title.Substring(0, titleMaxLength);
                trimmedPageTitle += "..";
            }
            else
            {
                trimmedPageTitle = pageTitle;
            }

            subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, trimmedPageTitle, true, true);
            masterLayout.AddChildToLayout(subTitleBar, 0, 1);
            subTitleBar.BackButtonTapRecognizer.Tapped += OnBackButtonTapRecognizerTapped;
            subTitleBar.NextButtonTapRecognizer.Tapped += NextButtonTapRecognizer_Tapped;
            #endregion

            #region EVENT TITLE - CUSTOM ENTRY

            eventTitle = new CustomEntry
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                BackgroundColor = Color.White,
                Placeholder = "Title",
                TextColor = Color.FromHex("#424646"),
                HeightRequest = Device.OnPlatform(50,50,73),
                WidthRequest = (int)(devWidth * .90) // 90% of screen,
            };
			eventTitle.TextChanged += EventTitle_TextChanged;

            
            //if (App.screenDensity > 1.5)
            //{
            //    eventTitle.HeightRequest = screenHeight * 6 / 100;
            //}
            //else
            //{
            //    eventTitle.HeightRequest = screenHeight * 9 / 100;
            //}
            masterLayout.AddChildToLayout(eventTitle, 5, 11);

            #endregion

            #region EVENT DESCRIPTION

            eventDescription = new CustomEditor
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                HeightRequest = 100,
                Placeholder = pageTitle,
                BackgroundColor = Color.White
            };
			eventDescription.TextChanged += EventDescription_TextChanged;
				

            eventDescription.WidthRequest = textInputWidth;

            if (detailsPageModel != null)
            {
				if (detailsPageModel.IsCopyingGem) {
					isUpdatePage = false;
				}
				else
				{
					isUpdatePage = true;
				}

                currentGemId = detailsPageModel.gemId;
                if (detailsPageModel.gemType != null)
                {
                    currentGemType = detailsPageModel.gemType;
                    switch (currentGemType)
                    {
                        case GemType.Goal:
                            pageTitle = Constants.EDIT_GOALS;
                            break;
                        case GemType.Event:
                            pageTitle = Constants.EDIT_EVENTS;
                            break;
                        case GemType.Action:
                            pageTitle = Constants.EDIT_ACTIONS;
                            break;
                        default:
                            break;
                    }
                }
                
                if (detailsPageModel.titleVal != null)
                {
                    eventTitle.Text = detailsPageModel.titleVal;
                }
                if ( detailsPageModel.description != null)
	            {
		             eventDescription.Text = detailsPageModel.description;
	            }
            }

            #endregion

            #region MEDIA INPUTS

            Image pinButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("icn_attach.png", "icn_attach.png", "//Assets//icn_attach.png"),

            };
            StackLayout pinButtonHolder = new StackLayout
            {
                Padding = 10,
                VerticalOptions = LayoutOptions.Start,
                Children = { pinButton }
            };
            TapGestureRecognizer pinButtonTapRecognizer = new TapGestureRecognizer();
            pinButtonHolder.GestureRecognizers.Add(pinButtonTapRecognizer);
            pinButtonTapRecognizer.Tapped += (s, e) =>
            {
                iconContainerGrid.IsVisible = !iconContainerGrid.IsVisible;
            };

            Image audioRecodeOnButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("mic.png", "mic.png", "//Assets//mic.png"),
            };
            audioRecodeOnHolder = new StackLayout
            {
                Padding = 10,
                VerticalOptions = LayoutOptions.End,
                Children = { audioRecodeOnButton }
            };
            TapGestureRecognizer RecodeOnTapRecognizer = new TapGestureRecognizer();
            audioRecodeOnHolder.GestureRecognizers.Add(RecodeOnTapRecognizer);

            audioRecodeOffButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("turn_off_mic.png", "turn_off_mic.png", "//Assets//turn_off_mic.png"),
            };
            audioRecodeOffHolder = new StackLayout
            {
                BackgroundColor = Color.Transparent,
                Padding = 10,
                VerticalOptions = LayoutOptions.End,
                IsVisible = false,
                Children = { audioRecodeOffButton }
            };
            TapGestureRecognizer RecodeOffTapRecognizer = new TapGestureRecognizer();
            audioRecodeOffHolder.GestureRecognizers.Add(RecodeOffTapRecognizer);

            audioRecodeOffHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null);
            audioRecodeOnHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null);

            RecodeOnTapRecognizer.Tapped += RecodeOnTapRecognizer_Tapped;
            RecodeOffTapRecognizer.Tapped += RecodeOffTapRecognizer_Tapped;

            StackLayout menuPinContainer = new StackLayout
            {
                BackgroundColor = Color.White,
                Orientation = StackOrientation.Vertical,
                HeightRequest = 140,
                WidthRequest = (int)(devWidth * .10),
                Children = {
                    pinButtonHolder, 
                    audioRecodeOnHolder, 
                    audioRecodeOffHolder
                }
            };


            TapGestureRecognizer locationlabelTap = new TapGestureRecognizer();

            locationInfo = new Label();
            locationInfo.TextColor = Constants.BLUE_BG_COLOR;
            locationInfo.BackgroundColor = Color.Transparent;
            locationInfo.FontSize = 12;
            locationInfo.HeightRequest = Device.OnPlatform(15, 25, 25);
            locationInfo.GestureRecognizers.Add(locationlabelTap);
            locationlabelTap.Tapped += OnEditLocationInfo;

            editLocationAndContactsStack = new StackLayout();
            editLocationAndContactsStack.Padding = new Thickness(1, 1, 1, 1);
            editLocationAndContactsStack.BackgroundColor = Color.FromRgb(30, 126, 210);
            editLocationAndContactsStack.WidthRequest = App.screenWidth * 90 / 100;
            editLocationAndContactsStack.IsVisible = false;
            editLocationAndContactsStack.Orientation = StackOrientation.Horizontal;


            locAndContactsEntry = new Entry();
            locAndContactsEntry.TextColor = Color.Black;
            locAndContactsEntry.BackgroundColor = Color.White;
            locAndContactsEntry.VerticalOptions = LayoutOptions.Center;
            locAndContactsEntry.WidthRequest = App.screenWidth * 80 / 100;
            locAndContactsEntry.HeightRequest = 50;

            editLocationDoneButton = new CustomImageButton();
            editLocationDoneButton.VerticalOptions = LayoutOptions.Center;
            editLocationDoneButton.ImageName = "icn_done.png";
            editLocationDoneButton.HeightRequest = 25;
            editLocationDoneButton.WidthRequest = 25;
            editLocationDoneButton.Clicked += OnLocationEditCompleted;


            editLocationAndContactsStack.Children.Add(locAndContactsEntry);
            editLocationAndContactsStack.Children.Add(editLocationDoneButton);

            if (Device.OS == TargetPlatform.iOS)
            {
                editLocationAndContactsStack.TranslationY = -30;
            }

            locLayout = new StackLayout();
            locLayout.Orientation = StackOrientation.Vertical;
            locLayout.BackgroundColor = Color.Transparent;



            locLayout.Children.Add(locationInfo);

            TapGestureRecognizer contactsLabelTap = new TapGestureRecognizer();
            contactInfo = new Label();
            contactInfo.TextColor = Constants.BLUE_BG_COLOR;
            contactInfo.BackgroundColor = Color.Transparent;
            contactInfo.FontSize = 12;
            contactInfo.HeightRequest = Device.OnPlatform(15, 25, 25);
            contactInfo.GestureRecognizers.Add(contactsLabelTap);
            contactsLabelTap.Tapped += async (object sender, EventArgs e) =>
            {
                editLocationAndContactsStack.ClassId = "contactedit";
                string spanContacts = "";
                if (contactInfo.FormattedText != null && contactInfo.FormattedText.Spans.Count > 1)
                    spanContacts = contactInfo.FormattedText.Spans[1].Text;
                locAndContactsEntry.Text = spanContacts;
                editLocationAndContactsStack.IsVisible = true;
                contactInfo.IsVisible = false;
                iconContainerGrid.IsVisible = false;
                locationInfo.IsVisible = true;

                await editLocationAndContactsStack.TranslateTo(100, 0, 300, Easing.SinInOut);
                await editLocationAndContactsStack.TranslateTo(0, 0, 300, Easing.SinIn);

            };

            locLayout.IsVisible = false;
            contactInfo.IsVisible = false;
            
            #endregion

            if(detailsPageModel != null)
            {
                if (detailsPageModel.eventMediaArray!= null && detailsPageModel.eventMediaArray.Count > 0)
                {
                    foreach (EventMedia eventObj in detailsPageModel.eventMediaArray)
                    {
						if (eventObj.event_media != null && !eventObj.event_media.Contains("default")) {
							AddFilenameToMediaList(eventObj.event_media);
						}
                    }
                }

                if (detailsPageModel.goal_media != null && detailsPageModel.goal_media.Count > 0)
                {
                    foreach (SelectedGoalMedia goalObj in detailsPageModel.goal_media)
                    {
						if (goalObj.goal_media != null && !goalObj.goal_media.Contains("default")) {
							AddFilenameToMediaList(goalObj.goal_media);
						}
                    }
                }

                if (detailsPageModel.actionMediaArray != null && detailsPageModel.actionMediaArray.Count > 0)
                {
                    foreach (ActionMedia actionObj in detailsPageModel.actionMediaArray)
                    {
						if (actionObj.action_media != null && !actionObj.action_media.Contains("default")) {
							AddFilenameToMediaList(actionObj.action_media);
						}
                    }
                }

            }



            StackLayout entryAndLocContainer = new StackLayout();
            entryAndLocContainer.Orientation = StackOrientation.Vertical;
            entryAndLocContainer.BackgroundColor = Color.White;
            entryAndLocContainer.Children.Add( eventDescription );
			entryAndLocContainer.Children.Add(contactInfo);
            entryAndLocContainer.Children.Add(locLayout);

            textInputContainer = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Spacing = 0,
                Padding = 0,
                Children = { entryAndLocContainer, menuPinContainer }
            };

            #region ICONS

            audioInput = new Image()
            {
                Source = Device.OnPlatform("ic_music.png", "ic_music.png", "//Assets//ic_music.png"),
                Aspect = Aspect.AspectFit
            };

            int ICON_SIZE = 8;

            if( Device.OS == TargetPlatform.WinPhone )
            {
                audioInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                audioInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }
            audioInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { audioInput 
                                /*, new Label { Text = "Audio", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }*/ 
                           }
            };

            cameraInput = new Image()
            {
                Source = Device.OnPlatform("icn_camera.png", "icn_camera.png", "//Assets//icn_camera.png"),
                Aspect = Aspect.AspectFit
            };



            if (Device.OS == TargetPlatform.WinPhone)
            {
                cameraInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                cameraInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }


            cameraInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { cameraInput
                                /*, new Label { Text = "Camera", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                                 */
                            }
            };
            cameraInputStack.ClassId = "camera";

            #region CAMERA TAP RECOGNIZER
            CameraTapRecognizer = new TapGestureRecognizer();
            cameraInputStack.GestureRecognizers.Add(CameraTapRecognizer);
            CameraTapRecognizer.Tapped += async (s, e) =>
            {
                try
                {
					await ApplyAnimation( cameraInputStack );
                    StackLayout send = s as StackLayout;
                    MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                    chooser.ClassId = "mediachooser";
                    masterLayout.AddChildToLayout(chooser, 0, 0);
                   
                }
                catch (System.Exception ex)
                {
                    DisplayAlert("Camera", ex.Message + " Please try again later", "ok");
                }

                /*
                try
                {
                    StackLayout send = s as StackLayout;
                    MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                    chooser.ClassId = "mediachooser";
                    masterLayout.AddChildToLayout(chooser, 0, 0);
                }
                catch (System.Exception ex)
                {
                    DisplayAlert("Camera", ex.Message + " Please try again later", "ok");
                }
                */
            };

            #endregion

            galleryInput = new Image()
            {
                Source = Device.OnPlatform("icn_gallery.png", "icn_gallery.png", "//Assets//icn_gallery.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                galleryInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                galleryInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }

            galleryInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                Spacing = 0,
                Children = { galleryInput 
                                //new Label { Text = "Gallery", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                            }
            };
            galleryInputStack.ClassId = "gallery";

            #region GALLERY  TAP RECOGNIZER

            TapGestureRecognizer galleryInputStackTapRecognizer = new TapGestureRecognizer();
            galleryInputStack.GestureRecognizers.Add(galleryInputStackTapRecognizer);
            galleryInputStackTapRecognizer.Tapped += async (s, e) =>
            {
				await ApplyAnimation( galleryInputStack );
                StackLayout send = s as StackLayout;
                MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                chooser.ClassId = "mediachooser";
                masterLayout.AddChildToLayout(chooser, 0, 0);

            };

            #endregion

            locationInput = new Image()
            {
                Source = Device.OnPlatform("icn_location.png", "icn_location.png", "//Assets//icn_location.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                locationInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                locationInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }


            locationInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { locationInput
                                //, new Label { Text = "Location", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                            }
            };

            #region LOCATION TAP RECOGNIZER

            TapGestureRecognizer locationInputTapRecognizer = new TapGestureRecognizer();
            locationInputStack.GestureRecognizers.Add(locationInputTapRecognizer);
            locationInputTapRecognizer.Tapped += LocationInputTapRecognizer_Tapped;

            #endregion

            contactInput = new Image()
            {
                Source = Device.OnPlatform("icn_contact.png", "icn_contact.png", "//Assets//icn_contact.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                contactInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                contactInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }

            contactInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 0, 10),
                Spacing = 0,
                Children = { contactInput
                    //new Label { Text = "Contact", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }
                     }
            };

            #region CONTACTS TAP RECOGNIZER

            TapGestureRecognizer contactsInputTapRecognizer = new TapGestureRecognizer();
            contactInputStack.GestureRecognizers.Add(contactsInputTapRecognizer);

            contactsInputTapRecognizer.Tapped += async (s, e) =>
            {
				await ApplyAnimation( contactInputStack );

				try
				{
					if( Device.OS == TargetPlatform.Android  || Device.OS == TargetPlatform.iOS )
					{
						IContactPicker testicker = DependencyService.Get< IContactPicker >();
						testicker.ShowContactPicker();
					}	
				}
				catch (Exception ex)
                {
                    DisplayAlert("contactsInputTapRecognizer: ", ex.Message, "ok");
                }
                 
            };

            #endregion

            #endregion

            #region ICON CONTAINER GRID

            iconContainerGrid = new Grid
            {
                IsVisible = false,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions = 
            {
                    new RowDefinition { Height = GridLength.Auto }
                },
                ColumnDefinitions = 
            {
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80) )/4, GridUnitType.Absolute) }, // icon container x = 3 //new ColumnDefinition { Width = GridLength.Auto },
                  //  new ColumnDefinition { Width = new GridLength(((screenWidth * .80)) /5, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
            }
            };

            iconContainerGrid.Children.Add(galleryInputStack, 0, 0);
            iconContainerGrid.Children.Add(cameraInputStack, 1, 0);
          //  iconContainerGrid.Children.Add(audioInputStack, 2, 0);
            iconContainerGrid.Children.Add(locationInputStack, 2, 0);
            iconContainerGrid.Children.Add(contactInputStack, 3, 0);

            textinputAndIconsHolder = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Padding = 0,
				Children = { textInputContainer, iconContainerGrid, editLocationAndContactsStack }
            };

            Button createEvent = new Button();
            if (pageTitle == Constants.ADD_ACTIONS || pageTitle == Constants.ADD_GOALS || pageTitle == Constants.EDIT_ACTIONS || pageTitle == Constants.EDIT_GOALS)
            {
                createEvent.BackgroundColor = Color.Transparent;
                createEvent.TextColor = Constants.BLUE_BG_COLOR;
                createEvent.Text = "Create Reminder";
                createEvent.FontSize = 12;
                createEvent.BorderWidth = 0;
                createEvent.BorderColor = Color.Transparent;
                createEvent.Clicked += createEvent_Clicked;
				if( Device.OS == TargetPlatform.iOS )
				createEvent.TranslationY = -8;
                textinputAndIconsHolder.Children.Add(createEvent);

            }
            masterLayout.AddChildToLayout(textinputAndIconsHolder, 5, 21);


            #region PREVIEW LIST
            listContainer = new StackLayout();
            listContainer.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            listContainer.WidthRequest = screenWidth * 90 / 100;
            listContainer.HeightRequest = screenHeight * 25 / 100;
            listContainer.ClassId = "preview";

            previewListView = new ListView();
            previewListView.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            PreviewListViewCellItem.addEvntObject = this;
            previewListView.ItemTemplate = new DataTemplate(typeof(PreviewListViewCellItem));
            previewListView.SeparatorVisibility = SeparatorVisibility.None;
            previewListView.Opacity = 1;
            previewListView.ItemsSource = App.PreviewListSource;
			previewListView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => 
			{
              /*  PreviewItem items = previewListView.SelectedItem as PreviewItem;
                if( items != null )
                App.Navigator.PushModalAsync( new VideoPlayerView( items.Path ) );*/
				previewListView.SelectedItem = null;
			};
            listContainer.Children.Add(previewListView);
            masterLayout.AddChildToLayout(listContainer, 5, Device.OnPlatform( 63, 63, 50 ));
            #endregion

			//masterLayout.AddChildToLayout(locationEditStack, 5, 30 );
            #endregion

            Content = masterLayout;
        }
Exemplo n.º 17
0
 public void InitGem()
 {
     type = GemType.NONE;
     GameManager.Instance.canClear = true;
 }
Exemplo n.º 18
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 5:
				{
					// erl: New "crafted by" and quality properties

					m_Crafter = reader.ReadMobile();
					m_Quality = (JewelQuality)reader.ReadShort();
					goto case 4;
				}
				case 4:
				{
					// remove AOS crap
					// see case 1 below
					goto case 3;
				}
				case 3:
				{
					m_MagicType = (JewelMagicEffect) reader.ReadInt();
					m_MagicCharges = reader.ReadInt();
					m_Identified = reader.ReadBool();

					goto case 2;
				}
				case 2:
				{
					m_Resource = (CraftResource)reader.ReadEncodedInt();
					m_GemType = (GemType)reader.ReadEncodedInt();

					goto case 1;
				}
				case 1:
				{
					// pack these out of furture versions.
					if (version < 4)
					{
						AosAttributes dmy_AosAttributes;
						AosElementAttributes dmy_AosResistances;
						AosSkillBonuses dmy_AosSkillBonuses;
						dmy_AosAttributes = new AosAttributes( this, reader );
						dmy_AosResistances = new AosElementAttributes( this, reader );
						dmy_AosSkillBonuses = new AosSkillBonuses( this, reader );

						if ( Core.AOS && Parent is Mobile )
							dmy_AosSkillBonuses.AddTo( (Mobile)Parent );

						int strBonus = dmy_AosAttributes.BonusStr;
						int dexBonus = dmy_AosAttributes.BonusDex;
						int intBonus = dmy_AosAttributes.BonusInt;

						if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
						{
							Mobile m = (Mobile)Parent;

							string modName = Serial.ToString();

							if ( strBonus != 0 )
								m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

							if ( dexBonus != 0 )
								m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

							if ( intBonus != 0 )
								m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
						}
					}

					if ( Parent is Mobile )
						((Mobile)Parent).CheckStatTimers();

					break;
				}
				case 0:
				{
					// pack these out of furture versions.
					if (version < 4)
					{
						AosAttributes dmy_AosAttributes;
						AosElementAttributes dmy_AosResistances;
						AosSkillBonuses dmy_AosSkillBonuses;
						dmy_AosAttributes = new AosAttributes( this );
						dmy_AosResistances = new AosElementAttributes( this );
						dmy_AosSkillBonuses = new AosSkillBonuses( this );
					}

					break;
				}
			}

			if ( version < 2 )
			{
				m_Resource = CraftResource.Iron;
				m_GemType = GemType.None;
			}

			if ( version < 5 )
			{
				m_Quality = JewelQuality.Regular;
			}
		}
Exemplo n.º 19
0
    public bool Match(Cell c)
    {
        bool           correct    = false;
        bool           newlyAdded = true;
        HashSet <Cell> match      = new HashSet <Cell>();
        GemType        gem        = c.GetContent().GetComponent <Gem>().type;

        //add origin to set
        //check up, left, down and right from origin
        //if same gem type, add to set
        //repeat for new elements in set
        //if no new elements are added, check length
        //if set.size > 2, return true
        match.Add(c);
        while (newlyAdded)
        {
            foreach (Cell i in match.ToList())
            {
                newlyAdded = false;
                if (i.y < height - 1 && cells[i.x, i.y + 1].GetContent().GetComponent <Gem>().type == gem)
                {
                    if (match.Add(cells[i.x, i.y + 1]))
                    {
                        newlyAdded = true;
                    }
                }
                if (i.y > 0 && cells[i.x, i.y - 1].GetContent().GetComponent <Gem>().type == gem)
                {
                    if (match.Add(cells[i.x, i.y - 1]))
                    {
                        newlyAdded = true;
                    }
                }
                if (i.x < width - 1 && cells[i.x + 1, i.y].GetContent().GetComponent <Gem>().type == gem)
                {
                    if (match.Add(cells[i.x + 1, i.y]))
                    {
                        newlyAdded = true;
                    }
                }
                if (i.x > 0 && cells[i.x - 1, i.y].GetContent().GetComponent <Gem>().type == gem)
                {
                    if (match.Add(cells[i.x - 1, i.y]))
                    {
                        newlyAdded = true;
                    }
                }
            }
        }
        if (match.Count > 2)
        {
            correct   = true;
            cascading = true;

            if (match.Count > 0)
            {
                foreach (Cell d in match)
                {
                    matched.Add(d);
                }
            }
        }
        manager.ResetPass();
        return(correct);
    }
Exemplo n.º 20
0
		public BaseJewel( int itemID, Layer layer ) : base( itemID )
		{
			//m_AosAttributes = new AosAttributes( this );
			//m_AosResistances = new AosElementAttributes( this );
			//m_AosSkillBonuses = new AosSkillBonuses( this );
			m_Resource = CraftResource.Iron;
			m_GemType = GemType.None;
			m_MagicType = JewelMagicEffect.None;
			m_MagicCharges = 0;
			m_Identified = true;
			Layer = layer;
			m_InvisTimer = null;
			m_StatEffectTimer = null;
		}
Exemplo n.º 21
0
    public static GemType getRandomGemType()
    {
        GemType gemType = (GemType)UnityEngine.Random.Range(0, (float)Enum.GetValues(typeof(GemType)).Cast <GemType>().Max());

        return(gemType);
    }
Exemplo n.º 22
0
 public Gem(GemType t, Point p)
 {
     type     = t;
     location = p;
 }
Exemplo n.º 23
0
 public void SpawnMinion(GemType type)
 {
     Debug.Log((int)type);
     pwm.Spawn((int)playerId, arrowIndex, (int)type);
 }
Exemplo n.º 24
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            {
                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 2;
            }

            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                if (Core.AOS && Parent is Mobile)
                {
                    m_AosSkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_AosAttributes.BonusStr;
                int dexBonus = m_AosAttributes.BonusDex;
                int intBonus = m_AosAttributes.BonusInt;

                if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
                {
                    Mobile m = (Mobile)Parent;

                    string modName = Serial.ToString();

                    if (strBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
                    }

                    if (dexBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
                    }

                    if (intBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
                    }
                }

                if (Parent is Mobile)
                {
                    ((Mobile)Parent).CheckStatTimers();
                }

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);
// Xml Spawner XmlSockets - SOF
// mod to randomly add sockets and socketability features to armor. These settings will yield
// 2% drop rate of socketed/socketable items
// 0.1% chance of 5 sockets
// 0.5% of 4 sockets
// 3% chance of 3 sockets
// 15% chance of 2 sockets
// 50% chance of 1 socket
// the remainder will be 0 socket (31.4% in this case)
// uncomment the next line to prevent artifacts from being socketed
// if(ArtifactRarity == 0)
                XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
// Xml Spawner XmlSockets - EOF

                break;
            }
            }

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
        public static async Task<string> AddToFavorite(string userId, string gemId, GemType gemType)
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                return "404";
            }

            try
            {
                string result = String.Empty;
                var client = new HttpClient();
                client.Timeout = new TimeSpan(0, 15, 0);
                client.BaseAddress = new Uri(Constants.SERVICE_BASE_URL);
                client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "multipart/form-data");

                var url = "api.php?action=addtofavorite";

                MultipartFormDataContent content = new MultipartFormDataContent();

                content.Add(new StringContent(userId, Encoding.UTF8), "user_id");

                switch (gemType)
                {
                    case GemType.Goal:
                        content.Add(new StringContent(gemId, Encoding.UTF8), "goal_id");
                        break;
                    case GemType.Event:
                        content.Add(new StringContent(gemId, Encoding.UTF8), "event_id");
                        break;
                    case GemType.Action:
                        content.Add(new StringContent(gemId, Encoding.UTF8), "goalaction_id");
                        break;
                    case GemType.Emotion:
                        break;
                    default:
                        break;
                }

                HttpResponseMessage response = null;
                try
                {
                    response = await client.PostAsync(url, content);
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }

                if (response != null && response.StatusCode == HttpStatusCode.OK)
                {
                    var eventsJson = response.Content.ReadAsStringAsync().Result;
                    var rootobject = JsonConvert.DeserializeObject<ResultJSon>(eventsJson);
                    if (rootobject.code != null)
                    {
                        client.Dispose();
                        return rootobject.code;
                    }
                }

                client.Dispose();
            }
            catch (Exception ex)
            {
                var test = ex.Message;
            }

            return "404";
        }
		//public GemsDetailsPage(List<EventMedia> mediaArray, List<ActionMedia> actionMediaArray, string pageTitleVal, string titleVal, string desc, string Media, string NoMedia, string gemId, GemType gemType)
		public CommunityGems(DetailsPageModel model)
		{
			NavigationPage.SetHasNavigationBar(this, false);
			masterLayout = new CustomLayout();
			masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244);
			masterScroll = new ScrollView();
			masterScroll.IsClippedToBounds = true;
			masterScroll.BackgroundColor = Color.FromRgb(244, 244, 244);
			progressBar = DependencyService.Get<IProgressBar>();
			currentUser = App.Settings.GetUser ();

			modelObject = model;
			CurrentGemId = model.gemId;
			CurrentGemType = model.gemType;

			cancelToken = new CancellationTokenSource ();
			mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", false);
			mainTitleBar.imageAreaTapGestureRecognizer.Tapped += OnImageAreaTapGestureRecognizerTapped;
			subTitleBar = new CommunityGemSubTitleBar(Constants.SUB_TITLE_BG_COLOR, Constants.COMMUNITY_GEMS, true);
			subTitleBar.myGemsTapRecognizer.Tapped += async (object sender, EventArgs e) => 
			{
				IProgressBar progress = DependencyService.Get<IProgressBar>();
				progress.ShowProgressbar( "Loading Mygems.." );

				CommunityGemsObject myGems = await ServiceHelper.GetMyGemsDetails();
				if( myGems != null )
				{
					//communityGems = null;
					Navigation.PushAsync( new MyGemsPage( myGems ) );
					myGemsCount = myGems.resultarray.Count;
				}

				progress.HideProgressbar();

				/*	masterStack.Children.Clear();
				masterStackLayout.Children.Clear();
				masterScroll.Content = null;

				RenderGems( communityGems );*/


			};
			subTitleBar.BackButtonTapRecognizer.Tapped += async (object sender, EventArgs e) =>
			{
				try
				{
					App.masterPage.IsPresented = !App.masterPage.IsPresented;
				}
				catch (Exception)
				{
				}
			};


			this.Appearing += OnAppearing;




			Label pageTitle = new Label();
			pageTitle.Text = model.pageTitleVal;
			pageTitle.TextColor = Color.Black;
			pageTitle.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
			pageTitle.FontAttributes = FontAttributes.Bold;
			pageTitle.WidthRequest = App.screenWidth * 80 / 100;
			pageTitle.HeightRequest = 50;
			pageTitle.XAlign = TextAlignment.Start;
			pageTitle.YAlign = TextAlignment.Start;
			pageTitle.FontSize = Device.OnPlatform(15, 20, 15);

			BoxView emptyLayout = new BoxView();
			emptyLayout.BackgroundColor = Color.Transparent;
			emptyLayout.WidthRequest = App.screenWidth * 90 / 100;
			emptyLayout.HeightRequest = 30;

			masterStackLayout = new StackLayout();
			masterStackLayout.Orientation = StackOrientation.Vertical;

			TapGestureRecognizer chatTap = new TapGestureRecognizer ();
			Image chat = new Image ();
			chat.Source = "chat.png";
			chat.Aspect = Aspect.Fill;
			chat.WidthRequest = App.screenWidth * 16 / 100;
			chat.HeightRequest = App.screenWidth * 12 / 100;
			chat.GestureRecognizers.Add ( chatTap );
			chatTap.Tapped += async (object sender, EventArgs e) => 
			{
				await Navigation.PushAsync( new ChatPage() );
			};

			masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
			masterLayout.AddChildToLayout(chat, 80, 1);
			masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10));
			masterLayout.AddChildToLayout(masterScroll, -1, 18);

			masterScroll.Scrolled += OnMasterScrollScrolled;

			Content = masterLayout;
		}
Exemplo n.º 27
0
    void ActByChaining(
        GemType gemType,
        string specialKey,
        Position sourcePosition,
        int repeat,
        Int64 markerID,
        Vector2 direction
        )
    {
        // Debug.Log("ActByChaining : " + gemType + ", " + specialKey + ", " + sourcePosition + ", " + markerID);
        switch (gemType)
        {
        case GemType.SuperGem:
            SameTypeBreaking(sourcePosition, GetRandomType(), markerID, isChaining: true);
            break;

        case GemType.ChocoGem:
            LinedBreaking(
                sourcePosition, GetRandomDirection(), repeat, markerID, breakingOffset: 5, comparingToMoveon: CompareIsMovable, isChaining: true
                );
            break;
        }

        switch (specialKey)
        {
        case Literals.SP:
            EmptyBlockBreaking(1, markerID);
            SameTypeBreaking(sourcePosition, gemType, markerID, isChaining: true);
            break;

        case Literals.H:
            LinedBreaking(sourcePosition, new Vector2 {
                x = -1, y = 0
            }, repeat, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true);
            LinedBreaking(sourcePosition, new Vector2 {
                x = 1, y = 0
            }, repeat, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true);
            break;

        case Literals.V:
            LinedBreaking(sourcePosition, new Vector2 {
                x = 0, y = -1
            }, repeat, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true);
            LinedBreaking(sourcePosition, new Vector2 {
                x = 0, y = 1
            }, repeat, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true);
            break;

        case Literals.C:
            RadialBreaking(sourcePosition, repeat, markerID, isChaining: true);
            break;

        case Literals.HH:
        case Literals.VV:
        case Literals.HV:
        case Literals.VH:
            LinedBreaking(sourcePosition, new Vector2 {
                x = -1, y = 0
            }, repeat, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true);
            LinedBreaking(sourcePosition, new Vector2 {
                x = 1, y = 0
            }, repeat, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true);
            LinedBreaking(sourcePosition, new Vector2 {
                x = 0, y = -1
            }, repeat, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true);
            LinedBreaking(sourcePosition, new Vector2 {
                x = 0, y = 1
            }, repeat, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true);
            break;

        case Literals.CC:
            RadialBreaking(sourcePosition, repeat, markerID, isChaining: true);
            break;

        case Literals.SQSQ:
            LinedRadialBreaking(
                sourcePosition, direction, repeat, markerID, isChaining: true, breakingOffset: 5, comparingToMoveon: CompareIsMovable
                );
            break;

        case Literals.SPSP:
            AllTypeBreaking(sourcePosition, markerID, isChaining: true);
            break;

        case Literals.CH:
        case Literals.HC:
            LinedRadialBreaking(
                sourcePosition, new Vector2 {
                x = -1, y = 0
            }, repeat, markerID, isChaining: true, comparingToMoveon: CompareIsBreakable
                );
            LinedRadialBreaking(
                sourcePosition, new Vector2 {
                x = 1, y = 0
            }, repeat, markerID, isChaining: true, comparingToMoveon: CompareIsBreakable
                );
            break;

        case Literals.CV:
        case Literals.VC:
            LinedRadialBreaking(
                sourcePosition, new Vector2 {
                x = 0, y = -1
            }, repeat, markerID, isChaining: true, comparingToMoveon: CompareIsBreakable
                );
            LinedRadialBreaking(
                sourcePosition, new Vector2 {
                x = 0, y = 1
            }, repeat, markerID, isChaining: true, comparingToMoveon: CompareIsBreakable
                );
            break;

        case Literals.HSQ:
        case Literals.SQH:
        case Literals.VSQ:
        case Literals.SQV:
            EmptyBlockBreaking(1, markerID);
            LinedBreaking(
                sourcePosition,
                direction,
                repeat,
                markerID,
                isChaining: true,
                breakingOffset: 5,
                comparingToMoveon: CompareIsMovable,
                onComplete: (latestPosition) => {
                LinedBreaking(
                    latestPosition, new Vector2 {
                    x = -1, y = 0
                }, int.MaxValue, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true
                    );
                LinedBreaking(
                    latestPosition, new Vector2 {
                    x = 1, y = 0
                }, int.MaxValue, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true
                    );
                LinedBreaking(
                    latestPosition, new Vector2 {
                    x = 0, y = -1
                }, int.MaxValue, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true
                    );
                LinedBreaking(
                    latestPosition, new Vector2 {
                    x = 0, y = 1
                }, int.MaxValue, markerID, comparingToMoveon: CompareIsBreakable, isChaining: true
                    );
            }
                );
            break;

        case Literals.CSQ:
        case Literals.SQC:
            EmptyBlockBreaking(1, markerID);
            LinedBreaking(
                sourcePosition,
                direction,
                repeat,
                markerID,
                isChaining: true,
                breakingOffset: 5,
                comparingToMoveon: CompareIsMovable,
                onComplete: (latestPosition) => {
                RadialBreaking(latestPosition, 1, markerID, isChaining: true);
            }
                );
            break;

        case Literals.HSP:
        case Literals.SPH:
        case Literals.VSP:
        case Literals.SPV:
            SameTypeReplacing(
                sourcePosition, gemType, markerID, new string[] { Literals.H, Literals.V }, repeat, isChaining: true
                );
            break;

        case Literals.CSP:
        case Literals.SPC:
            SameTypeReplacing(
                sourcePosition, gemType, markerID, new string[] { Literals.C }, repeat, isChaining: true
                );
            break;

        case Literals.SPSQ:
        case Literals.SQSP:
            SameTypeReplacing(
                sourcePosition, GetRandomType(), markerID, new string[] { Literals.SQ }, repeat, isChaining: true
                );
            break;
        }
    }
Exemplo n.º 28
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            {
                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 2;
            }

            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                if (Core.AOS && Parent is Mobile)
                {
                    m_AosSkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_AosAttributes.BonusStr;
                int dexBonus = m_AosAttributes.BonusDex;
                int intBonus = m_AosAttributes.BonusInt;

                if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
                {
                    Mobile m = (Mobile)Parent;

                    string modName = Serial.ToString();

                    if (strBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
                    }

                    if (dexBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
                    }

                    if (intBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
                    }
                }

                if (Parent is Mobile)
                {
                    ((Mobile)Parent).CheckStatTimers();
                }

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);

                break;
            }
            }

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
Exemplo n.º 29
0
 public void SetType(GemType type)
 {
     this.type = type;
 }
Exemplo n.º 30
0
 public LargeTinkerBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries, GemType gemType)
 {
     Hue                = 1109;
     AmountMax          = amountMax;
     Entries            = entries;
     RequireExceptional = reqExceptional;
     Material           = mat;
     _GemType           = gemType;
 }
Exemplo n.º 31
0
 public void Awake(GemData data, GemType type)
 {
     gemData        = data;
     this.m_GemType = type;
 }
Exemplo n.º 32
0
		public BaseJewel( int itemID, Layer layer ) : base( itemID )
		{
			m_AosAttributes = new AosAttributes( this );
			m_AosResistances = new AosElementAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_Resource = CraftResource.Iron;
			m_GemType = GemType.None;

			Layer = layer;

			#region Mondain's Legacy Sets
			m_SetAttributes = new AosAttributes( this );
			m_SetSkillBonuses = new AosSkillBonuses( this );
			#endregion
		}
Exemplo n.º 33
0
        public void AddJewelrySet(GemType gemType, Type itemType)
        {
            var offset = (int)gemType - 1;

            var index = AddCraft(
                typeof(GoldRing),
                1044049,
                1044176 + offset,
                40.0,
                90.0,
                typeof(IronIngot),
                1044036,
                2,
                1044037
                );

            AddRes(index, itemType, 1044231 + offset, 1, 1044240);

            index = AddCraft(
                typeof(SilverBeadNecklace),
                1044049,
                1044185 + offset,
                40.0,
                90.0,
                typeof(IronIngot),
                1044036,
                2,
                1044037
                );
            AddRes(index, itemType, 1044231 + offset, 1, 1044240);

            index = AddCraft(
                typeof(GoldNecklace),
                1044049,
                1044194 + offset,
                40.0,
                90.0,
                typeof(IronIngot),
                1044036,
                2,
                1044037
                );
            AddRes(index, itemType, 1044231 + offset, 1, 1044240);

            index = AddCraft(
                typeof(GoldEarrings),
                1044049,
                1044203 + offset,
                40.0,
                90.0,
                typeof(IronIngot),
                1044036,
                2,
                1044037
                );
            AddRes(index, itemType, 1044231 + offset, 1, 1044240);

            index = AddCraft(
                typeof(GoldBeadNecklace),
                1044049,
                1044212 + offset,
                40.0,
                90.0,
                typeof(IronIngot),
                1044036,
                2,
                1044037
                );
            AddRes(index, itemType, 1044231 + offset, 1, 1044240);

            index = AddCraft(
                typeof(GoldBracelet),
                1044049,
                1044221 + offset,
                40.0,
                90.0,
                typeof(IronIngot),
                1044036,
                2,
                1044037
                );
            AddRes(index, itemType, 1044231 + offset, 1, 1044240);
        }
Exemplo n.º 34
0
 public void AddJewelrySet(GemType gemType, Type itemType)
 {
     int offset = (int)gemType - 1;
 }
        public GemsDetailsPage( DetailsPageModel model )
        {
			try
			{
				NavigationPage.SetHasNavigationBar(this, false);
				detailsPageModel = model;
				masterLayout = new CustomLayout();
				masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244);
				masterScroll = new ScrollView();
				masterScroll.BackgroundColor = Color.FromRgb(244, 244, 244);
				masterScroll.IsClippedToBounds = true;
				progressBar = DependencyService.Get<IProgressBar>();
				masterStack = new CustomLayout();
				//masterStack.Orientation = StackOrientation.Vertical;
				masterStack.BackgroundColor = Color.FromRgb(244, 244, 244);
				mediaList = model.eventMediaArray;
				actionMediaList = model.actionMediaArray;
				CurrentGemId = model.gemId;
				CurrentGemType = model.gemType;
				User user = null;
				App.GemDeleted = false;

				try
				{
					user = App.Settings.GetUser();
				}
				catch (Exception ex)
				{
					var test = ex.Message;
				}
				if (string.IsNullOrEmpty (model.pageTitleVal)) {
					model.pageTitleVal = "GEM Details";
				}
				mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true);
				mainTitleBar.imageAreaTapGestureRecognizer.Tapped += OnImageAreaTapGestureRecognizerTapped;
				subTitleBar = new PurposeColorSubTitleBar(Constants.SUB_TITLE_BG_COLOR, model.pageTitleVal, false);
				subTitleBar.BackButtonTapRecognizer.Tapped += async (object sender, EventArgs e) =>
				{
					try
					{
						await Navigation.PopAsync();
					}
					catch (Exception){
					}
				};


				this.Appearing += GemsDetailsPage_Appearing;

				Label pageTitle = new Label();
				pageTitle.Text = model.titleVal;//model.pageTitleVal;
				pageTitle.TextColor = Color.Black;
				pageTitle.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
				pageTitle.FontAttributes = FontAttributes.Bold;
				pageTitle.WidthRequest = App.screenWidth * 80 / 100;
				pageTitle.HeightRequest = 50;
				pageTitle.XAlign = TextAlignment.Start;
				pageTitle.YAlign = TextAlignment.Start;
				pageTitle.FontSize = Device.OnPlatform(15, 20, 15);

				StackLayout emptyLayout = new StackLayout();
				emptyLayout.BackgroundColor = Color.Transparent;
				emptyLayout.WidthRequest = App.screenWidth * 90 / 100;
				emptyLayout.HeightRequest = 30;

				#region TOOLS LAYOUT

				StackLayout toolsLayout = new StackLayout();
				toolsLayout.Spacing = App.screenWidth * .10;
				toolsLayout.Orientation = StackOrientation.Horizontal;
				toolsLayout.HorizontalOptions = LayoutOptions.Center;
				toolsLayout.HeightRequest = App.screenHeight * .05;
				toolsLayout.Padding = new Thickness(10, 5, 10, 10);
				toolsLayout.ClassId = "ToolsLayout";

				favoriteButton = new Image();
				favoriteButton.Source = Device.OnPlatform("favoriteIcon.png", "favoriteIcon.png", "//Assets//favoriteIcon.png");
				favoriteButton.WidthRequest = Device.OnPlatform(15, 15, 15);
				favoriteButton.HeightRequest = Device.OnPlatform(15, 15, 15);
				favoriteButton.VerticalOptions = LayoutOptions.Center;
				favoriteButtonTap = new TapGestureRecognizer();
				favoriteButtonTap.Tapped += FavoriteButtonTapped;
				favoriteButton.GestureRecognizers.Add(favoriteButtonTap);

				favoriteLabel = new Label
				{
					Text = "Favorite",
					FontFamily = Constants.HELVERTICA_NEUE_LT_STD,
					TextColor = Color.Gray,
					VerticalOptions = LayoutOptions.Center,
					FontSize = Device.OnPlatform(12,12,15)
				};
				favoriteLabel.GestureRecognizers.Add(favoriteButtonTap);
				toolsLayout.Children.Add( new StackLayout{Children = {favoriteButton,favoriteLabel}, Orientation = StackOrientation.Horizontal, Spacing = 5});

				//toolsLayout.Children.Add(favoriteButton);
				//toolsLayout.Children.Add(favoriteLabel);

				if (user.AllowCommunitySharing)
				{
					shareButton = new Image();
					shareButton.Source = Device.OnPlatform("share.png", "share.png", "//Assets//share.png");
					shareButton.WidthRequest = Device.OnPlatform(15, 15, 15);
					shareButton.HeightRequest = Device.OnPlatform(15, 15, 15);
					shareButton.VerticalOptions = LayoutOptions.Center;
					shareLabel = new Label
					{
						Text = "Share",
						FontFamily = Constants.HELVERTICA_NEUE_LT_STD,
						TextColor = Color.Gray,
						VerticalOptions = LayoutOptions.Center,
						FontSize = Device.OnPlatform(12,12,15)
					};
					shareButtonTap = new TapGestureRecognizer();
					shareButtonTap.Tapped += ShareButtonTapped;
					shareButton.GestureRecognizers.Add(shareButtonTap);
					shareLabel.GestureRecognizers.Add(shareButtonTap);
					toolsLayout.Children.Add(new StackLayout{Children = {shareButton,shareLabel}, Orientation = StackOrientation.Horizontal, Spacing = 5});
					//toolsLayout.Children.Add(shareLabel);
				}



				Image commentButton = new Image();
				commentButton.Source = Device.OnPlatform("icon_cmnt.png", "icon_cmnt.png", "//Assets//icon_cmnt.png");
				commentButton.WidthRequest = Device.OnPlatform(15, 15, 15);
				commentButton.HeightRequest = Device.OnPlatform(15, 15, 15);
				commentButton.VerticalOptions = LayoutOptions.Center;
				commentsLabel = new Label
				{
					Text = "Comments",
					VerticalOptions = LayoutOptions.Center,
					FontFamily = Constants.HELVERTICA_NEUE_LT_STD,
					TextColor = Color.Gray,
					FontSize = Device.OnPlatform(12,12,15),
					ClassId = "CommentLabel"
				};

				commentButtonTap = new TapGestureRecognizer();
				commentButtonTap.Tapped += CommentButtonTapped;
				commentButton.GestureRecognizers.Add(commentButtonTap);
				commentsLabel.GestureRecognizers.Add(commentButtonTap);

				toolsLayout.Children.Add( new StackLayout{Children = {commentButton,commentsLabel}, Orientation = StackOrientation.Horizontal, Spacing = 5});
				//toolsLayout.Children.Add(commentButton);
				//toolsLayout.Children.Add(commentsLabel);

				#endregion

				#region  title, description
				title = new Label ();
				title.Text = model.titleVal;
				title.TextColor = Color.Black;
				title.WidthRequest = App.screenWidth * 90 / 100;
				title.FontSize = Device.OnPlatform (12, 12, 12);
				title.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;

				description = new Label ();
				description.WidthRequest = App.screenWidth * .75;
				description.Text = model.description;
				description.TextColor = Color.Black;
				description.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;

				Image menuButton = new Image
				{
					Source = Device.OnPlatform("downarrow.png", "downarrow.png", "//Assets//downarrow.png"),
					HorizontalOptions = LayoutOptions.End,
					BackgroundColor = Color.Transparent,
					WidthRequest = Device.OnPlatform(25, 25, 60),
					HeightRequest = Device.OnPlatform(25, 25, 40),
					Aspect = Aspect.AspectFit
				};

				TapGestureRecognizer editMenuGesture = new TapGestureRecognizer();
				editMenuGesture.Tapped += GemMenuButton_Clicked;
				menuButton.GestureRecognizers.Add(editMenuGesture);

				masterStack.AddChildToLayout(pageTitle, 2, Device.OnPlatform(0,1,1));
				masterStack.AddChildToLayout(menuButton, Device.OnPlatform(87, 90, 99), Device.OnPlatform(0,1,1));
				//masterStack.AddChildToLayout(title,1,Device.OnPlatform(3,7,7));
				#endregion

				StackLayout bottomAndLowerControllStack = new StackLayout
				{
					Orientation = StackOrientation.Vertical,
					BackgroundColor = Color.Transparent,
					Spacing = 1,
					Padding = 0,// new Thickness(0, 0, 0, 5),
					WidthRequest = App.screenWidth,// * .90,
					ClassId= "BottomNlowerStack"
				};
				bottomAndLowerControllStack.Children.Add(new StackLayout { Padding = new Thickness(6, 0, 0, 5), Children = { description } });

				#region MEDIA LIST

				if (mediaList != null)
				{
					for (int index = 0; index < mediaList.Count; index++)
					{
						TapGestureRecognizer videoTap = new TapGestureRecognizer();
						videoTap.Tapped += OnEventVideoTapped;
						bool isValidUrl = (mediaList[index].event_media != null && !string.IsNullOrEmpty(mediaList[index].event_media)) ? true : false;
						string source = (isValidUrl) ? model.Media + mediaList[index].event_media : Device.OnPlatform("noimage.png", "noimage.png", "//Assets//noimage.png");
						string fileExtenstion = Path.GetExtension(source);
						bool isImage = (fileExtenstion == ".png" || fileExtenstion == ".jpg" || fileExtenstion == ".jpeg") ? true : false;
						//img.WidthRequest = App.screenWidth;// * 50 / 100;
						Image img = new Image();

						if(isImage)
							img.HeightRequest = App.screenWidth * 1.1;
						else
						{
							img.HeightRequest = App.screenWidth;
						}
						
						//img.MinimumHeightRequest = App.screenWidth;
						//img.MinimumWidthRequest = App.screenWidth;

						img.Aspect = Aspect.AspectFill;
						img.ClassId = null;
						if (mediaList[index] != null && mediaList[index].media_type == "mp4")
						{
							img.ClassId = source;
							source = Constants.SERVICE_BASE_URL + mediaList[index].video_thumb;
						}
						else if (mediaList[index] != null && (mediaList[index].media_type == "3gpp" || mediaList[index].media_type == "aac") )
						{
							img.ClassId = source;
							source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png");
						}
						else if (mediaList[index] != null && mediaList[index].media_type == "wav")
						{
							img.ClassId = source;
							source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png");
						}
						img.Source = source;
						img.GestureRecognizers.Add(videoTap);

						var indicator = new ActivityIndicator { Color = new Color(.5), };
						indicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading");
						indicator.BindingContext = img;
						masterStack.AddChildToLayout(indicator, 40, Device.OnPlatform(50,40,40));
						if (isValidUrl)
						{

							if (mediaList[index] != null && mediaList[index].media_type == "mp4")
							{
								Grid grid = new Grid
								{
									VerticalOptions = LayoutOptions.FillAndExpand,
									HorizontalOptions = LayoutOptions.FillAndExpand,
									RowDefinitions = 
									{
										new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) },
										new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) },
										new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) },

									},
									ColumnDefinitions = 
									{
										new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) },
										new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) },
										new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) },

									}
									};

								Image play = new Image();
								play.Source = "video_play.png";
								play.Aspect = Aspect.AspectFit;
								play.WidthRequest = 75;
								play.HeightRequest = 75;
								play.HorizontalOptions = LayoutOptions.Center;
								play.VerticalOptions = LayoutOptions.Center;
								play.ClassId =  mediaList[index].event_media ;
								play.GestureRecognizers.Add(videoTap);

								BoxView box = new BoxView();
								box.BackgroundColor = Color.Red;
								box.WidthRequest = 100;
								box.HeightRequest = 100;

								grid.Children.Add( img, 0, 0 );
								Grid.SetColumnSpan(img, 3);
								Grid.SetRowSpan( img, 3 );
								grid.Children.Add(play, 1, 1);
								bottomAndLowerControllStack.Children.Add(grid);
							}
							else
							{
								bottomAndLowerControllStack.Children.Add(img);
							}
						}


					}
				}

				if (actionMediaList != null)
				{
					for (int index = 0; index < actionMediaList.Count; index++)
					{
						TapGestureRecognizer videoTap = new TapGestureRecognizer();
						videoTap.Tapped += OnActionVideoTapped;

						Image img = new Image();
						bool isValidUrl = (actionMediaList[index].action_media != null && !string.IsNullOrEmpty(actionMediaList[index].action_media)) ? true : false;
						string source = (isValidUrl) ? model.Media + actionMediaList[index].action_media : Device.OnPlatform("noimage.png", "noimage.png", "//Assets//noimage.png");
						string fileExtenstion = Path.GetExtension(source);
						bool isImage = (fileExtenstion == ".png" || fileExtenstion == ".jpg" || fileExtenstion == ".jpeg") ? true : false;
						//img.WidthRequest = App.screenWidth;// * 50 / 100;
						if(isImage)
							img.HeightRequest = App.screenWidth * 1.1;
						else
						{
							img.HeightRequest = App.screenWidth;
						}
						
						img.Aspect = Aspect.AspectFill;
						img.ClassId = null;
						if (actionMediaList[index] != null && actionMediaList[index].media_type == "mp4")
						{
							img.ClassId = source;
							source = Constants.SERVICE_BASE_URL + actionMediaList[index].video_thumb;
						}
						else if (actionMediaList[index] != null && (actionMediaList[index].media_type == "3gpp" || actionMediaList[index].media_type == "aac"))
						{
							img.ClassId = source;
							source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png");
						}
						else if (actionMediaList[index] != null && actionMediaList[index].media_type == "wav")
						{
							img.ClassId = source;
							source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png");
						}
						img.Source = source;
						img.GestureRecognizers.Add(videoTap);
						var indicator = new ActivityIndicator { Color = new Color(.5), };
						indicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading");
						indicator.BindingContext = img;
						masterStack.AddChildToLayout(indicator, 40, Device.OnPlatform(50,40,40));
						if (isValidUrl)
						{
							if (actionMediaList[index] != null && actionMediaList[index].media_type == "mp4")
							{
								Grid grid = new Grid
								{
									VerticalOptions = LayoutOptions.FillAndExpand,
									HorizontalOptions = LayoutOptions.FillAndExpand,
									RowDefinitions = 
									{
										new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) },
										new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) },
										new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) },

									},
									ColumnDefinitions = 
									{
										new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) },
										new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) },
										new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) },

									}
									};

								Image play = new Image();
								play.Source = "video_play.png";
								play.Aspect = Aspect.AspectFit;
								play.WidthRequest = 75;
								play.HeightRequest = 75;
								play.HorizontalOptions = LayoutOptions.Center;
								play.VerticalOptions = LayoutOptions.Center;
								play.ClassId =  actionMediaList[index].action_media ;
								play.GestureRecognizers.Add(videoTap);

								BoxView box = new BoxView();
								box.BackgroundColor = Color.Red;
								box.WidthRequest = 100;
								box.HeightRequest = 100;

								grid.Children.Add( img, 0, 0 );
								Grid.SetColumnSpan(img, 3);
								Grid.SetRowSpan( img, 3 );
								grid.Children.Add(play, 1, 1);
								bottomAndLowerControllStack.Children.Add(grid);
							}
							else
							{
								bottomAndLowerControllStack.Children.Add(img);
							}
						}
					}
				}


				if (model.goal_media != null)
				{
					ScrollView imgScrollView = new ScrollView();
					imgScrollView.Orientation = ScrollOrientation.Horizontal;

					//StackLayout horizmgConatiner = new StackLayout();
					// horizmgConatiner.Orientation = StackOrientation.Horizontal;

					for (int index = 0; index < model.goal_media.Count; index++)
					{
						TapGestureRecognizer videoTap = new TapGestureRecognizer();
						videoTap.Tapped += OnActionVideoTapped;

						Image img = new Image();
						bool isValidUrl = (model.goal_media[index].goal_media != null && !string.IsNullOrEmpty(model.goal_media[index].goal_media)) ? true : false;
						string source = (isValidUrl) ?  model.goal_media[index].goal_media : Device.OnPlatform("noimage.png", "noimage.png", "//Assets//noimage.png");
						string fileExtenstion = Path.GetExtension(source);
						bool isImage = (fileExtenstion == ".png" || fileExtenstion == ".jpg" || fileExtenstion == ".jpeg") ? true : false;
						//img.WidthRequest = App.screenWidth;// * 50 / 100;
						if(isImage)
							img.HeightRequest = App.screenWidth * 1.1;
						else
						{
							img.HeightRequest = App.screenWidth;
						}
						
						img.Aspect = Aspect.AspectFill;
						img.ClassId = null;
						if (model.goal_media[index] != null && model.goal_media[index].media_type == "mp4")
						{

							source = Constants.SERVICE_BASE_URL +  model.goal_media[index].video_thumb;
							img.ClassId = source;
						}
						else if (model.goal_media[index] != null && (model.goal_media[index].media_type == "3gpp" || model.goal_media[index].media_type == "aac"))
						{
							img.ClassId = source;
							source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png");
						}
						else if (model.goal_media[index] != null && model.goal_media[index].media_type == "wav")
						{
							img.ClassId = source;
							source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png");
						}
						img.Source = source;
						img.GestureRecognizers.Add(videoTap);
						var indicator = new ActivityIndicator { Color = new Color(.5), };
						indicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading");
						indicator.BindingContext = img;
						masterStack.AddChildToLayout(indicator, 40, Device.OnPlatform(50,40,40));
						// horizmgConatiner.Children.Add(img);
						if( isValidUrl )
						{
							if ( model.goal_media[index]!= null &&  model.goal_media[index].media_type == "mp4")
							{
								Grid grid = new Grid
								{
									VerticalOptions = LayoutOptions.FillAndExpand,
									HorizontalOptions = LayoutOptions.FillAndExpand,
									RowDefinitions = 
									{
										new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) },
										new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) },
										new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) },

									},
									ColumnDefinitions = 
									{
										new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) },
										new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) },
										new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) },

									}
									};

								Image play = new Image();
								play.Source = "video_play.png";
								play.Aspect = Aspect.AspectFit;
								play.WidthRequest = 75;
								play.HeightRequest = 75;
								play.HorizontalOptions = LayoutOptions.Center;
								play.VerticalOptions = LayoutOptions.Center;
								play.ClassId =   Constants.SERVICE_BASE_URL +  model.goal_media[index].goal_media ;
								play.GestureRecognizers.Add(videoTap);

								BoxView box = new BoxView();
								box.BackgroundColor = Color.Red;
								box.WidthRequest = 100;
								box.HeightRequest = 100;

								grid.Children.Add( img, 0, 0 );
								Grid.SetColumnSpan(img, 3);
								Grid.SetRowSpan( img, 3 );
								grid.Children.Add(play, 1, 1);
								//horizmgConatiner.Children.Add(grid);
								bottomAndLowerControllStack.Children.Add(grid);
							}
							else
							{
								//horizmgConatiner.Children.Add(img);
								bottomAndLowerControllStack.Children.Add(img);
							}
						}

					}

					// imgScrollView.Content = horizmgConatiner;
					// bottomAndLowerControllStack.Children.Add(imgScrollView);
				}

				#endregion

				//masterStack.AddChildToLayout(toolsLayout,1,65);
				//masterStack.AddChildToLayout(emptyLayout,1,75);
				bottomAndLowerControllStack.Children.Add(toolsLayout);
				bottomAndLowerControllStack.Children.Add(emptyLayout);
				if (model.titleVal.Length < 25) {
					masterStack.AddChildToLayout (bottomAndLowerControllStack, 0, 8);
				} else {
					masterStack.AddChildToLayout (bottomAndLowerControllStack, 0, 11);
				}

				StackLayout spaceOffsetlayout = new StackLayout();
				spaceOffsetlayout.WidthRequest = App.screenWidth * 50 / 100;
				spaceOffsetlayout.HeightRequest = Device.OnPlatform(100, 100, 250);
				spaceOffsetlayout.BackgroundColor = Color.Transparent;
				//masterStack.AddChildToLayout(spaceOffsetlayout, 1, 85);
				bottomAndLowerControllStack.Children.Add(spaceOffsetlayout);

				masterScroll.HeightRequest = App.screenHeight - 20;
				masterScroll.WidthRequest = App.screenWidth; //App.screenWidth * 90 / 100;

				masterScroll.Content = masterStack;

				masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
				masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10));
				masterLayout.AddChildToLayout(masterScroll,0, Device.OnPlatform(16,18,18));

				#region CUSTOM LIST MENU

				//new CustomListViewItem { EmotionID = item.EmotionId.ToString(), Name = item.EmpotionName, SliderValue = item.EmotionValue  }

				#endregion

				Content = masterLayout;
			} 
			catch (Exception ex)
			{
				Debug.WriteLine ( ex.Message );
			}
        }
Exemplo n.º 36
0
        public override void Update(GameTime gameTime)
        {
            if (!_ScoreServ.gameOver)
            {
                _dropDownTimer += gameTime.ElapsedGameTime.TotalSeconds;

                if (_dropDownTimer >= time_between_block_drops)
                {
                    _dropDownTimer -= time_between_block_drops;
                    moveFallingGems();
                }

                if (_remainingMoves <= 0 && _ScoreServ.Score < 50000)
                {
                    spawnRow();
                }
                else if (_remainingMoves <= 0 && _ScoreServ.Score >= 50000)
                {
                    spawnRow();
                    moveFallingGems();
                    spawnRow();
                }

                if (!_blocksAreFalling)
                {
                    if (_input.mouseClick())
                    {
                        if (gameFrame.Contains(_input.MousePosition()))
                        {
                            {
                                if (_selected.X == -1 && _selected.Y == -1)
                                {
                                    _selected.X = _input.MousePosition().X / 80;
                                    _selected.Y = _input.MousePosition().Y / 80;
                                    GemType selectedGem = Playfield[_selected.X, _selected.Y];
                                    if (selectedGem == GemType.None)
                                    {
                                        _selected.X = _selected.Y = -1;
                                    }
                                }
                                else
                                {
                                    Point   newSelection = new Point(_input.MousePosition().X / 80, _input.MousePosition().Y / 80);
                                    GemType selectedGem  = Playfield[newSelection.X, newSelection.Y];
                                    if (selectedGem == GemType.None || (_selected.X == newSelection.X) && _selected.Y == newSelection.Y)
                                    {
                                        _selected.X = _selected.Y = -1;
                                    }
                                    else
                                    {
                                        int distance = Math.Abs(_selected.X - newSelection.X) + Math.Abs(_selected.Y - newSelection.Y);
                                        if (distance == 1)
                                        {
                                            Playfield[newSelection.X, newSelection.Y] = Playfield[_selected.X, _selected.Y];
                                            Playfield[_selected.X, _selected.Y]       = selectedGem;
                                            _selected.X = _selected.Y = -1;
                                            _remainingMoves--;
                                            _dropDownTimer = time_between_block_drops;
                                            _ScoreServ.clickCount++;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    detectClusters();
                }
            }
            base.Update(gameTime);
        }
Exemplo n.º 37
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 5:
            {
                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 4;
            }

                #region Mondain's Legacy Sets
            case 4:
            {
                m_LastEquipped = reader.ReadBool();
                m_SetEquipped  = reader.ReadBool();
                m_SetHue       = reader.ReadEncodedInt();

                m_SetAttributes   = new AosAttributes(this, reader);
                m_SetSkillBonuses = new AosSkillBonuses(this, reader);

                goto case 3;
            }

                #endregion
                #region Mondain's Legacy
            case 3:
            {
                m_Crafter = reader.ReadMobile();
                m_Quality = (ArmorQuality)reader.ReadInt();

                goto case 2;
            }

                #endregion
            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                if (Core.AOS && Parent is Mobile)
                {
                    m_AosSkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_AosAttributes.BonusStr;
                int dexBonus = m_AosAttributes.BonusDex;
                int intBonus = m_AosAttributes.BonusInt;

                if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
                {
                    Mobile m = (Mobile)Parent;

                    string modName = Serial.ToString();

                    if (strBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
                    }

                    if (dexBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
                    }

                    if (intBonus != 0)
                    {
                        m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
                    }
                }

                if (Parent is Mobile)
                {
                    ((Mobile)Parent).CheckStatTimers();
                }

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);

                break;
            }
            }

            #region Mondain's Legacy Sets
            if (m_SetAttributes == null)
            {
                m_SetAttributes = new AosAttributes(this);
            }

            if (m_SetSkillBonuses == null)
            {
                m_SetSkillBonuses = new AosSkillBonuses(this);
            }
            #endregion

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
Exemplo n.º 38
0
 public Amethyst(GemType gemType) : base(gemType, InitialStrength, InitialAgility, InitialVitality)
 {
     this.IncreaseBonusPoints();
 }
Exemplo n.º 39
0
        /// <summary>
        /// Detect possible swaps.
        /// </summary>
        public MatchSwap?DetectSwap(LevelMap map)
        {
            for (int i = 0; i < map.Height; ++i)
            {
                for (int j = 1; j < map.Width - 1; ++j)
                {
                    // Get gem type of neighbour gems.
                    GemType self  = map[i, j];
                    GemType left  = map[i, j - 1];
                    GemType right = map[i, j + 1];
                    GemType up    = (i > 0)              ? map[i - 1, j] : GemType.None;
                    GemType down  = (i < map.Height - 1) ? map[i + 1, j] : GemType.None;

                    bool leftRightMatched = Gem.IsMatched(left, right);
                    bool leftSelfMatched  = Gem.IsMatched(left, self);
                    bool rightSelfMatched = Gem.IsMatched(right, self);

                    // X O X
                    if (leftRightMatched && !leftSelfMatched)
                    {
                        GemType matchedType = Gem.GetMatchedGemType(left, right);

                        if (Gem.IsMatched(matchedType, up))
                        {
                            return(CreateMatchSwap(j, i, j, i - 1, matchedType));
                        }

                        if (Gem.IsMatched(matchedType, down))
                        {
                            return(CreateMatchSwap(j, i, j, i + 1, matchedType));
                        }
                    }

                    // Magic Gem may apply to both cases below
                    // so we have to check both cases separately

                    // X X O
                    if (leftSelfMatched)
                    {
                        GemType   matchedType = Gem.GetMatchedGemType(left, self);
                        MatchSwap?swap        = DetectGemSwap(map, j + 1, i, matchedType, new Vector2Int(-1, 0));
                        if (swap.HasValue)
                        {
                            return(swap);
                        }
                    }

                    // O X X
                    if (rightSelfMatched)
                    {
                        GemType   matchedType = Gem.GetMatchedGemType(right, self);
                        MatchSwap?swap        = DetectGemSwap(map, j - 1, i, matchedType, new Vector2Int(1, 0));
                        if (swap.HasValue)
                        {
                            return(swap);
                        }
                    }
                }
            }

            return(null);
        }
Exemplo n.º 40
0
        public void AssignGemType(Type jewelType)
        {
            _GemType = (GemType)Utility.RandomMinMax(1, 9);

            AssignGemNumber(jewelType);
        }
Exemplo n.º 41
0
 public void AssignGemType()
 {
     _GemType = (GemType)Utility.RandomMinMax(1, 9);
     AssignGemNumbers();
 }
Exemplo n.º 42
0
 public SmallTinkerBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat, int hue, GemType gemType)
 {
     Hue                = 1109;
     AmountMax          = amountMax;
     AmountCur          = amountCur;
     Type               = type;
     Number             = number;
     Graphic            = graphic;
     RequireExceptional = reqExceptional;
     Material           = mat;
     GraphicHue         = hue;
     GemType            = gemType;
 }
Exemplo n.º 43
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 7:
            {
                goto case 6;
            }

            case 6:
            {
                goto case 5;
            }

            case 5:
            {
                m_BlessedBy = reader.ReadMobile();

                m_Crafter = reader.ReadMobile();
                m_Quality = (ArmorQuality)reader.ReadInt();
                goto case 3;
            }

            case 3:
            {
                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 2;
            }

            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                if (Parent is Mobile)
                {
                    ((Mobile)Parent).CheckStatTimers();
                }

                break;
            }

            case 0:
            {
                break;
            }
            }

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
Exemplo n.º 44
0
 public CacheItemGemEntry(int snoid, GemType type, GemQualityTypes quality)
 {
     SnoId   = snoid;
     Type    = type;
     Quality = quality;
 }
Exemplo n.º 45
0
		public BaseJewel( int itemID, Layer layer ) : base( itemID )
		{
			m_Resource = CraftResource.Iron;
			m_GemType = GemType.None;

			Layer = layer;

			m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits );
		}
Exemplo n.º 46
0
 public void MakeNewGem()
 {
     //I need a way to make this adjust with colors list
     myType = (GemType)Random.Range(0, _mostRecentGemMax);
     name   = Address + myType.ToString();
 }
        public static async Task<List<Comment>> GetComments(string gemId, GemType gemType, bool isCommunityGem = false)
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                return null;
            }

            try
            {
                string result = String.Empty;
                var client = new HttpClient();
                client.Timeout = new TimeSpan(0, 15, 0);
                client.BaseAddress = new Uri(Constants.SERVICE_BASE_URL);
                client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "multipart/form-data");

                var url = "api.php?action=getcomments";

                MultipartFormDataContent content = new MultipartFormDataContent();


                switch (gemType)
                {
                    case GemType.Goal:
                        content.Add(new StringContent(gemId, Encoding.UTF8), "goal_id");
                        break;
                    case GemType.Event:
                        content.Add(new StringContent(gemId, Encoding.UTF8), "event_id");
                        break;
                    case GemType.Action:
                        content.Add(new StringContent(gemId, Encoding.UTF8), "goalaction_id");
                        break;
                    case GemType.Emotion:
                        break;
                    default:
                        break;
                }

                if (isCommunityGem)
                {
                    content.Add(new StringContent("1", Encoding.UTF8), "share_comment");
                }
                else
                {
                    content.Add(new StringContent("0", Encoding.UTF8), "share_comment");
                }

                HttpResponseMessage response = await client.PostAsync(url, content);

                if (response != null && response.StatusCode == HttpStatusCode.OK)
                {
                    var eventsJson = response.Content.ReadAsStringAsync().Result;
                    var rootobject = JsonConvert.DeserializeObject<GetCommentsResult>(eventsJson);
                    if (rootobject != null && rootobject.resultarray != null)
                    {
                        client.Dispose();
                        return rootobject.resultarray;
                    }
                }
                client.Dispose();
            }
            catch (Exception ex)
            {
                var test = ex.Message;
            }

            return null;
        }
Exemplo n.º 48
0
 public void MakeNewRandomGem(int max)
 {
     _mostRecentGemMax = max;
     myType            = (GemType)Random.Range(0, max);
     name = Address + myType.ToString();
 }
        public static async Task<string> DeleteMediaFromGem(string gemId, GemType gemtype, string mediaName)
        {
            try
            {
                if (!CrossConnectivity.Current.IsConnected)
                {
                    return "404";
                }

                var client = new System.Net.Http.HttpClient();
                client.DefaultRequestHeaders.Add("Post", "application/json");
                client.BaseAddress = new Uri(Constants.SERVICE_BASE_URL);
                string gemIdString = string.Empty;

                switch (gemtype)
                {
                    case GemType.Goal:
                        gemIdString = "&goal_id=";
                        break;
                    case GemType.Event:
                        gemIdString = "&event_id=";
                        break;
                    case GemType.Action:
                        gemIdString = "&goalaction_id=";
                        break;
                    case GemType.Emotion:
                        gemIdString = "&emotion_id=";
                        break;
                    default:
                        break;
                }

                string uriString = "api.php?action=deletemedia"+ gemIdString + gemId+"&media_file=" + mediaName ;

                var response = await client.GetAsync(uriString);

                if (response != null && response.StatusCode == HttpStatusCode.OK)
                {
                    var responseJson = response.Content.ReadAsStringAsync().Result;
                    var rootobject = JsonConvert.DeserializeObject<CodeAndTextOnlyResponce>(responseJson);
                    if (rootobject != null && rootobject.code != null)
                    {
                        return rootobject.code;
                    }
                }

            }
            catch (Exception ex)
            {
                var test = ex.Message;
            }

            return "404";
        }
Exemplo n.º 50
0
 public void MakeNewGemOfType(GemType myNewType)
 {
     myType = myNewType;
     name   = Address + myType.ToString();
 }
Exemplo n.º 51
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 6: m_OldJewel = reader.ReadBool(); goto case 5;
                case 5: m_Seal = reader.ReadString(); goto case 4;
                case 4:
                case 3:
                {
                    m_Crafter = reader.ReadMobile();
                    m_CraftersOriginalName = reader.ReadString();
                    m_Quality = (WeaponQuality)reader.ReadInt();
                    goto case 2;
                }
                case 2:
                {
                    m_Resource = (CraftResource)reader.ReadEncodedInt();
                    m_GemType = (GemType)reader.ReadEncodedInt();

                    goto case 1;
                }
                case 1:
                {
                    m_AosAttributes = new AosAttributes( this, reader );
                    m_AosResistances = new AosElementAttributes( this, reader );
                    m_AosSkillBonuses = new AosSkillBonuses( this, reader );

                    if ( Core.AOS && Parent is Mobile )
                        m_AosSkillBonuses.AddTo( (Mobile)Parent );

                    int strBonus = m_AosAttributes.BonusStr;
                    int dexBonus = m_AosAttributes.BonusDex;
                    int intBonus = m_AosAttributes.BonusInt;

                    if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
                    {
                        Mobile m = (Mobile)Parent;

                        string modName = Serial.ToString();

                        if ( strBonus != 0 )
                            m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

                        if ( dexBonus != 0 )
                            m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

                        if ( intBonus != 0 )
                            m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
                    }

                    if ( Parent is Mobile )
                        ((Mobile)Parent).CheckStatTimers();

                    break;
                }
                case 0:
                {
                    m_AosAttributes = new AosAttributes( this );
                    m_AosResistances = new AosElementAttributes( this );
                    m_AosSkillBonuses = new AosSkillBonuses( this );

                    break;
                }
            }

            if ( version < 2 )
            {
                m_Resource = CraftResource.Iron;
                m_GemType = GemType.None;
            }

            if( version < 4 )
                Hue = 0;

            if (!String.IsNullOrEmpty(m_Seal) && !Seals.Contains(m_Seal))
                Seals.Add(m_Seal);
        }
Exemplo n.º 52
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				#region ItemID_Mods
				case (3):
				{
				m_Identified = reader.ReadBool();
				goto case 2;
				}
				#endregion
				case 2:
				{
					m_Resource = (CraftResource)reader.ReadEncodedInt();
					m_GemType = (GemType)reader.ReadEncodedInt();

					goto case 1;
				}
				case 1:
				{
					m_AosAttributes = new AosAttributes( this, reader );
					m_AosResistances = new AosElementAttributes( this, reader );
					m_AosSkillBonuses = new AosSkillBonuses( this, reader );

					if ( Core.AOS && Parent is Mobile )
						m_AosSkillBonuses.AddTo( (Mobile)Parent );

					int strBonus = m_AosAttributes.BonusStr;
					int dexBonus = m_AosAttributes.BonusDex;
					int intBonus = m_AosAttributes.BonusInt;

					if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
					{
						Mobile m = (Mobile)Parent;

						string modName = Serial.ToString();

						if ( strBonus != 0 )
							m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

						if ( dexBonus != 0 )
							m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

						if ( intBonus != 0 )
							m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
					}

					if ( Parent is Mobile )
						((Mobile)Parent).CheckStatTimers();

					break;
				}
				case 0:
				{
					m_AosAttributes = new AosAttributes( this );
					m_AosResistances = new AosElementAttributes( this );
					m_AosSkillBonuses = new AosSkillBonuses( this );

					break;
				}
			}

			if ( version < 2 )
			{
				m_Resource = CraftResource.Iron;
				m_GemType = GemType.None;
			}
		}
Exemplo n.º 53
0
		public BaseJewel( int itemID, Layer layer ) : base( itemID )
		{
			m_AosAttributes = new AosAttributes( this );
			m_AosResistances = new AosElementAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_Resource = CraftResource.Iron;
			m_GemType = GemType.None;

			Layer = layer;

			m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits );

			#region Mondain's Legacy Sets
			m_SetAttributes = new AosAttributes( this );
			m_SetSkillBonuses = new AosSkillBonuses( this );
			#endregion

            #region SA
			m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this );
			#endregion

			ItemValue = GearScore.GetItemValue( this );
        }
Exemplo n.º 54
0
        public BaseJewel(int itemID, Layer layer)
            : base(itemID)
        {
            this.m_AosAttributes = new AosAttributes(this);
            this.m_AosResistances = new AosElementAttributes(this);
            this.m_AosSkillBonuses = new AosSkillBonuses(this);
            this.m_Resource = CraftResource.Iron;
            this.m_GemType = GemType.None;

            this.Layer = layer;

            this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits);

            this.m_SetAttributes = new AosAttributes(this);
            this.m_SetSkillBonuses = new AosSkillBonuses(this);
            this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
            m_NegativeAttributes = new NegativeAttributes(this);
        }
Exemplo n.º 55
0
        public void AddJewelrySet( GemType gemType, Type itemType, string gemName )
        {
            int offset = (int)gemType - 1;

            int index = AddCraft( typeof( GoldRing ), 1044049, gemName + " Gold Ring", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( SilverRing ), 1044049, gemName + " Silver Ring", 40.0, 90.0, typeof( SilverIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( GoldNecklace ), 1044049, gemName + " Gold Necklace", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( SilverNecklace ), 1044049, gemName + " Silver Necklace", 40.0, 90.0, typeof( SilverIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( GoldEarrings ), 1044049, gemName + " Gold Earrings", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( SilverEarrings ), 1044049, gemName + " Silver Earrings", 40.0, 90.0, typeof( SilverIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( LargeGoldEarrings ), 1044049, gemName + " Large Gold Earrings", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( LargeSilverEarrings ), 1044049, gemName + " Large Silver Earrings", 40.0, 90.0, typeof( SilverIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( GoldBeadNecklace ), 1044049, gemName + " Gold Bead Necklace", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( GoldAnkhNecklace ), 1044049, gemName + " Gold Ankh Necklace", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( DelicateGoldBeadNecklace ), 1044049, gemName + " Delicate Gold Bead Necklace", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( ExtravagantGoldNecklace ), 1044049, gemName + " Extravagant Gold Necklace", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( LargeGoldNecklace ), 1044049, gemName + " Large Gold Necklace", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( SilverBeadNecklace ), 1044049, gemName + " Silver Bead Necklace", 40.0, 90.0, typeof( SilverIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( SilverSerpentNecklace ), 1044049, gemName + " Silver Serpent Necklace", 40.0, 90.0, typeof( SilverIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( LargeSilverNecklace ), 1044049, gemName + " Large Silver Necklace", 40.0, 90.0, typeof( SilverIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( GoldBracelet ), 1044049, gemName + " Gold Bracelet", 40.0, 90.0, typeof( GoldIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );

            index = AddCraft( typeof( SilverBracelet ), 1044049, gemName + " Silver Bracelet", 40.0, 90.0, typeof( SilverIngot ), 1044036, 1, 1044037 );
            AddRes( index, itemType, 1044231 + offset, 1, 1044240 );
        }
Exemplo n.º 56
0
 public static GemData GemOfType(GemType type)
 {
     return(instance.gems.Find(gem => gem.type == type));
 }
Exemplo n.º 57
0
		public BaseJewel( int itemID, Layer layer ) : base( itemID )
		{
			m_AosAttributes = new AosAttributes( this );
			m_AosResistances = new AosElementAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_Resource = CraftResource.Iron;
			m_GemType = GemType.None;

            Layer = layer;
            // mod to randomly add sockets and socketability features to weapons. These settings will yield
            // 2% drop rate of socketed/socketable items
            // 0.1% chance of 5 sockets
            // 0.5% of 4 sockets
            // 3% chance of 3 sockets
            // 15% chance of 2 sockets
            // 50% chance of 1 socket
            // the remainder will be 0 socket (31.4% in this case)
            // uncomment the next line to prevent artifacts from being socketed
            // if(ArtifactRarity == 0)
            XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
		}
Exemplo n.º 58
0
 public virtual void OnGemTypeChange(GemType old)
 {
 }
Exemplo n.º 59
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 7:
                    {
                        this.m_IsImbued = reader.ReadBool();
                        goto case 6;
                    }
                case 6:
                    {
                        m_NegativeAttributes = new NegativeAttributes(this, reader);
                        goto case 5;
                    }
                case 5:
                    {
                        #region Runic Reforging
                        m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt();
                        m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt();
                        m_ItemPower = (ItemPower)reader.ReadInt();
                        m_BlockRepair = reader.ReadBool();
                        #endregion

                        #region Stygian Abyss
                        m_GorgonLenseCharges = reader.ReadInt();
                        m_GorgonLenseType = (LenseType)reader.ReadInt();
                        goto case 4;
                    }
                case 4:
                    {
                        this.m_TimesImbued = reader.ReadEncodedInt();
                       
                        this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
                        #endregion

                        this.m_BlessedBy = reader.ReadMobile();
                        this.m_LastEquipped = reader.ReadBool();
                        this.m_SetEquipped = reader.ReadBool();
                        this.m_SetHue = reader.ReadEncodedInt();

                        this.m_SetAttributes = new AosAttributes(this, reader);
                        this.m_SetSkillBonuses = new AosSkillBonuses(this, reader);

                        this.m_Crafter = reader.ReadMobile();
                        this.m_Quality = (ArmorQuality)reader.ReadInt();
                        goto case 3;
                    }
                case 3:
                    {
                        this.m_MaxHitPoints = reader.ReadEncodedInt();
                        this.m_HitPoints = reader.ReadEncodedInt();

                        goto case 2;
                    }
                case 2:
                    {
                        this.m_Resource = (CraftResource)reader.ReadEncodedInt();
                        this.m_GemType = (GemType)reader.ReadEncodedInt();

                        goto case 1;
                    }
                case 1:
                    {
                        this.m_AosAttributes = new AosAttributes(this, reader);
                        this.m_AosResistances = new AosElementAttributes(this, reader);
                        this.m_AosSkillBonuses = new AosSkillBonuses(this, reader);

                        if (Core.AOS && this.Parent is Mobile)
                            this.m_AosSkillBonuses.AddTo((Mobile)this.Parent);

                        int strBonus = this.m_AosAttributes.BonusStr;
                        int dexBonus = this.m_AosAttributes.BonusDex;
                        int intBonus = this.m_AosAttributes.BonusInt;

                        if (this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
                        {
                            Mobile m = (Mobile)this.Parent;

                            string modName = this.Serial.ToString();

                            if (strBonus != 0)
                                m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));

                            if (dexBonus != 0)
                                m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));

                            if (intBonus != 0)
                                m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
                        }

                        if (this.Parent is Mobile)
                            ((Mobile)this.Parent).CheckStatTimers();

                        break;
                    }
                case 0:
                    {
                        this.m_AosAttributes = new AosAttributes(this);
                        this.m_AosResistances = new AosElementAttributes(this);
                        this.m_AosSkillBonuses = new AosSkillBonuses(this);

                        break;
                    }
            }

            if (m_NegativeAttributes == null)
                m_NegativeAttributes = new NegativeAttributes(this);

            #region Mondain's Legacy Sets
            if (this.m_SetAttributes == null)
                this.m_SetAttributes = new AosAttributes(this);

            if (this.m_SetSkillBonuses == null)
                this.m_SetSkillBonuses = new AosSkillBonuses(this);
            #endregion

            if (version < 2)
            {
                this.m_Resource = CraftResource.Iron;
                this.m_GemType = GemType.None;
            }
        }
Exemplo n.º 60
0
 private void FinishGame(GemType winner)
 {
     _currentPlayer = GemType.None;
     _winnerBoard.Show();
     _winnerBoard.SetWinner(winner);
 }