Example #1
0
        private void AddDTDGameObject()
        {
            DTDGameObject = FindCurrentGameObjectIfExist();
            if (DTDGameObject != null)
            {
                UnityEngine.Object.DestroyImmediate(DTDGameObject);
            }
            DTDGameObject      = new GameObject();
            DTDGameObject.name = DTDGameObjectName;

            DTDScriptObject = DTDGameObject.AddComponent(typeof(DevToDevSDK)) as DevToDevSDK;
            DTDScriptObject.IsAnaluticsEnabled    = Model.IsAnalyticsEnabled;
            DTDScriptObject.IsPushMessagesEnabled = Model.IsPushMessagesEnabled;
            DTDScriptObject.IsLogEnabled          = Model.IsLogEnabled;
            DTDScriptObject.Credentials           = Model.Credentials.ToArray();
            DTDScriptObject.FirebaseSenderId      = Model.PushFirebaseSenderId;
            if (PushGameObject != null)
            {
                DTDScriptObject.PushListeners   = GetSafeFromArray(PushScripts, PushGameObjectScriptIndex, null);
                DTDScriptObject.OnTokenReceived = GetSafeFromArray(PushTokenMethods, PushTokenFunctionIndex, string.Empty);
                DTDScriptObject.OnTokenFailed   = GetSafeFromArray(PushTokenMethods, PushTokenErrorFunctionIndex, string.Empty);
                DTDScriptObject.OnPushReceived  = GetSafeFromArray(PushReceivedMethods, PushReceivedFunctionIndex, string.Empty);
                DTDScriptObject.OnPushOpened    = GetSafeFromArray(PushOpenedMethods, PushOpenedFunctionIndex, string.Empty);
            }
        }
Example #2
0
        public DTDEditorViewModel()
        {
            Model = LoadModel();

            PushGameObject = GameObject.Find(Model.PushGameObjectName);

            if (PushGameObject != null)
            {
                DTDGameObject = FindCurrentGameObjectIfExist();
                if (DTDGameObject != null)
                {
                    DTDScriptObject = DTDGameObject.GetComponent <DevToDevSDK>();
                    UpdateGameObject();
                }
            }
        }