Example #1
0
        private static void FlyGraphics_ctor(On.FlyGraphics.orig_ctor orig, FlyGraphics self, PhysicalObject ow)
        {
            orig(self, ow);

            customColor = null;
            World world = ow.abstractPhysicalObject.world;

            if (world != null && !world.singleRoomWorld && world.region != null)
            {
                foreach (KeyValuePair <string, string> keyValues in CustomWorldMod.activatedPacks)
                {
                    if (CustomWorldMod.installedPacks[keyValues.Key].regionConfig.TryGetValue(world.region.name,
                                                                                              out CustomWorldStructs.RegionConfiguration config))
                    {
                        if (!config.batVanilla)
                        {
                            CustomWorldMod.Log($"Glowing batfly in [{world.region.name}] from [{CustomWorldMod.installedPacks[keyValues.Key].name}]",
                                               false, CustomWorldMod.DebugLevel.FULL);
                            customColor = config.batFlyColor;
                            break;
                        }
                    }
                }
            }
        }
Example #2
0
		public BaseGUIElement(string text, U.Rect rect, U.FontStyle fontStyle, U.Color? color = null)
		{
			m_text = text;
			m_position = null;
			m_rect = rect;
			m_fontStyle = fontStyle;
			m_color = color ?? U.Color.white;
		}
Example #3
0
		public BaseGUIElement(string text, U.Vector3 position, U.Color? color = null)
		{
			m_text = text;
			m_position = position;
			m_rect = null;
			m_fontStyle = U.FontStyle.Normal;
			m_color = color ?? U.Color.white;
		}
Example #4
0
    public void SetText(string text, GameObject target, UnityEngine.Color?col = null)
    {
        Vector2 targetPos = Camera.main.WorldToScreenPoint(target.transform.position);

        targetPos.x       += Random.Range(-OffsetRange, OffsetRange);
        targetPos.y       += Random.Range(-OffsetRange, OffsetRange);
        transform.position = targetPos;

        GetComponent <Text>().text  = text;
        GetComponent <Text>().color = col ?? Color.green;
    }
        /// <param name="color">If null then Color.white will be used.</param>
        public void SendChatMessage(string message, UnityEngine.Color?color = null)
        {
            var writer = server.CreateMessage();

            writer.Write(MessageType.ChatMessage);
            writer.Write(0); // player id (0 = equivalent of null)
            writer.Write((string)null);
            writer.WriteRgbaColor(color ?? UnityEngine.Color.white);
            writer.Write(message);

            Peer.SendMessage(writer, NetDeliveryMethod.ReliableOrdered, 0);
        }
Example #6
0
    public void SetText(string text, GameObject target, float fontIncrement, UnityEngine.Color?col = null)
    {
        Vector2 targetPos = Camera.main.WorldToScreenPoint(target.transform.position);


        targetPos.x += Random.Range(-OffsetRange, OffsetRange);
        targetPos.y += Random.Range(-OffsetRange, OffsetRange);

        transform.position = targetPos;

        int newFontSize = (int)(GetComponent <Text>().fontSize *fontIncrement);

        GetComponent <Text>().fontSize = newFontSize;
        GetComponent <Text>().text     = text;
        GetComponent <Text>().color    = col ?? Color.white;
    }
Example #7
0
    public static void MakeOverlay(UnityEngine.Color?key = null)
    {
        // Layered, click-through.
        SetWindowLong(Active, GWL_EX_STYLE, WS_EX_LAYERED | WS_EX_TRANSPARENT);

        // Transparency.
        if (key.HasValue)
        {
            SetLayeredWindowAttributes(Active, new COLORREF(key.Value), 0, LWA_COLORKEY);
        }
        else
        {
            MARGINS margins = new MARGINS()
            {
                cxLeftWidth = -1
            };
            DwmExtendFrameIntoClientArea(Active, ref margins);
        }

        // Topmost.
        SetWindowPos(Active, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
    }
Example #8
0
		public GUIImage(U.Vector3 position, U.Texture2D image, U.Color? color = null)
			: base("", position, color)
		{
			this.image = image;
		}
Example #9
0
		public GUILabel(string text, U.Rect rect, U.FontStyle fontStyle, U.Color? color = null)
			: base(text, rect, fontStyle, color)
		{
		}
Example #10
0
		public GUILabel(string text, U.Vector3 position, U.FontStyle fontStyle, U.Color? color = null)
			: base(text, position, fontStyle, color)
		{
		}
        /// <summary>
        /// Load an in-app campaign from a JSON response.
        /// </summary>
        /// <param name="campaignData">
        /// JSON object with the individual campaign data.
        /// </param>
        /// <param name="initialisedTime">
        /// Time that the SDK was initialised. Used for rules checking.
        /// </param>
        /// <param name="assetPath">
        /// Path to the folder that will store all the assets.
        /// </param>
        /// <returns>
        /// Parsed in-app campaign.
        /// </returns>
        public static SwrveBaseCampaign LoadFromJSON(ISwrveAssetsManager swrveAssetsManager, Dictionary <string, object> campaignData, DateTime initialisedTime, UnityEngine.Color?defaultBackgroundColor, List <SwrveQaUserCampaignInfo> qaUserCampaignInfoList)
        {
            SwrveBaseCampaign campaign = LoadFromJSONWithNoValidation(swrveAssetsManager, campaignData, initialisedTime, defaultBackgroundColor, qaUserCampaignInfoList);

            if (campaign == null)
            {
                return(null);
            }

            AssignCampaignTriggers(campaign, campaignData);
            campaign.MessageCenter = campaignData.ContainsKey(MESSAGE_CENTER_KEY) && (bool)campaignData[MESSAGE_CENTER_KEY];

            if (!campaign.MessageCenter && (campaign.GetTriggers().Count == 0))
            {
                string reason = "Campaign [" + campaign.Id + "], has no triggers. Skipping this campaign.";
                campaign.LogAndAddReason(reason, false, qaUserCampaignInfoList);
                return(null);
            }

            AssignCampaignRules(campaign, campaignData);
            AssignCampaignDates(campaign, campaignData);
            campaign.Subject = campaignData.ContainsKey(SUBJECT_KEY) ? (string)campaignData[SUBJECT_KEY] : "";

            return(campaign);
        }
        public static SwrveBaseCampaign LoadFromJSONWithNoValidation(ISwrveAssetsManager swrveAssetsManager, Dictionary <string, object> campaignData, DateTime initialisedTime, UnityEngine.Color?defaultBackgroundColor, List <SwrveQaUserCampaignInfo> qaUserCampaignInfoList = null)
        {
            int id = MiniJsonHelper.GetInt(campaignData, ID_KEY);
            SwrveBaseCampaign campaign = null;

            if (campaignData.ContainsKey(CONVERSATION_KEY))
            {
                campaign = SwrveConversationCampaign.LoadFromJSON(swrveAssetsManager, campaignData, id, initialisedTime);
            }
            else if (campaignData.ContainsKey(MESSAGES_KEY))
            {
                campaign = SwrveInAppCampaign.LoadFromJSON(swrveAssetsManager, campaignData, id, initialisedTime, defaultBackgroundColor, qaUserCampaignInfoList);
            }
            else if (campaignData.ContainsKey(EMBEDDED_MESSAGE_KEY))
            {
                campaign = SwrveEmbeddedCampaign.LoadFromJSON(campaignData, initialisedTime, qaUserCampaignInfoList);
            }

            if (campaign == null)
            {
                return(null);
            }
            campaign.Id = id;
            return(campaign);
        }
Example #13
0
		public GUIButton(string text, U.Rect rect, System.Action onClick, U.FontStyle fontStyle, U.Color? color = null)
			: base(text, rect, fontStyle, color)
		{
			this.onClick = onClick;
		}
Example #14
0
		public GUILabel(string text, U.Vector3 position, U.Rect rect, U.FontStyle fontStyle = U.FontStyle.Normal, U.Color? color = null)
			: base(text, position, rect, fontStyle, color)
		{
		}
Example #15
0
		public GUIImage(U.Vector3 position, U.Rect rect, U.Texture2D image, U.Color? color = null)
			: base("", position, rect)
		{
			this.image = image;
			m_color = color ?? U.Color.white;
		}
Example #16
0
		public GUILabel(string text, U.Rect rect, U.Color? color = null)
			: base(text, rect, color)
		{
		}
Example #17
0
		public GUIImage(U.Rect rect, U.Texture2D image, U.Color? color = null)
			: base("", rect, color)
		{
			this.image = image;
		}
Example #18
0
		public GUIButton(string text, U.Vector3 position, U.Rect rect, System.Action onClick, U.FontStyle fontStyle = U.FontStyle.Normal, U.Color? color = null)
			: base(text, position, rect, fontStyle, color)
		{
			this.onClick = onClick;
		}
Example #19
0
		public GUIButton(string text, U.Vector3 position, System.Action onClick, U.Color? color = null)
			: base(text, position, color)
		{
			this.onClick = onClick;
		}