private static void TestAttendanceMission()
        {
            var data = DataTableManager.Instance.dailyAttendanceData.GetDailyData();

            if (data != null)
            {
                AdaNetwork.GetProcess <MissionProcess>().missionManager.UpdateMission(MissionPlay_type.PARTICIPATE,
                                                                                      MissionCategory_type.DAILYATTENDANCE, data.mission_tag);
            }
        }
Esempio n. 2
0
 public static void ToNativeDone(string InType)
 {
     switch (InType)
     {
     case "ChallengeResult":
     {
         AdaNetwork.GetProcess <ChallengeProcess>().challengeResult = null;
         break;
     }
     }
 }
        static void OnStylebookEdit(JSONNode InParam)
        {
            JSONArray account_id_list = InParam["account_id_list"].AsArray;
            int       stylebook_id    = InParam["stylebook_id"];

            PageManager.Instance.PrevNativeData = InParam;
            // 初始化合拍数据
            StyleBookProcess.SelectedPeopleInfoClear();
            // 单人合拍
            if (account_id_list.Count <= 1)
            {
                // UIPageInterface.OnStyleBookEdit(stylebook_id);
                StyleBookCaptureImage.Instance.StartCapture(stylebook_id);
                return;
            }
            AdaNetwork.GetProcess <StyleBookProcess>().InitSelectPeopleInfoList(account_id_list);
            StyleBookCaptureImage.Instance.MultiplayerCapture(stylebook_id);
        }
        public static void ShareToNative(string InPicturePath, int InContentType = 0,
                                         Action <bool> InCallbackAction          = null)
        {
            JSONObject jsonObject = new JSONObject
            {
                ["sinaTitle"]        = "",
                ["friendTitle"]      = "",
                ["zoneTitle"]        = "",
                ["des"]              = "",
                ["url"]              = "",
                ["imgUrl"]           = "",
                ["logoDes"]          = "",
                ["logoName"]         = "",
                ["appBrandPath"]     = "",
                ["passThrougnParam"] = "",
                ["requestParam"]     = "",
                ["contentType"]      = InContentType,
                ["withShareTicket"]  = false,
                ["miniProgramType"]  = 0,
                ["imgLocalPath"]     = InPicturePath
            };

            Log.Info($"[ThirdPartyBridge.ToNative] : Type = {CommandType.Share}, JsonData = {jsonObject}",
                     ColorName.Tan);

            _customCallbackDict[(int)CommandType.Share] = (InCommandType, InJsonNode, InExtra) =>
            {
                bool result = InJsonNode["shareResult"].AsInt == (int)Result.Success;
                InCallbackAction?.Invoke(result);
                if (result)
                {
                    AdaNetwork.GetProcess <MissionProcess>().SocialTrackingInterface("ACTIVITY", "SHARE");
                }
            };

            SendCustomCommand((int)CommandType.Share, jsonObject);
        }
        public static void GotoUnity(JSONNode InParam)
        {
            Debug.Log("ThirdPartyGotoUnity GotoUnity " + InParam.ToString());
            string url = InParam["url"];

            if (url == "Stylebook")
            {   // is not page only funciton
                ThirdPartyBridge.SetNativeTabBarActivity(false);
                OnStylebookEdit(InParam);
                return;
            }

            WebViewController.Instance.ActiveGameSceneCam(true);
            Szn.Framework.Audio.AudioManager.Instance.FadeTurnSound(false);
            if (url == "Home")
            {
                ThirdPartyBridge.SetNativeTabBarActivity(true);
                UIPageInterface.OnMainLobby();
                return;
            }
            ThirdPartyBridge.SetNativeTabBarActivity(false);



            switch (url)
            {
            case "RankingInfo":
            {
                StyleBookCaptureImage.Instance.SetAllPartsDefault();
                int type      = InParam["type"];
                int accountId = InParam["account_id"];
                if (accountId == AccountManager.Instance.GetUserAccountID())
                {
                    ThirdPartyBridge.SetNativeTabBarActivity(true);
                    UIPageInterface.OnMainLobby();
                }
                else
                {
                    UIPageInterface.OnRankingRoom(accountId, type);
                    EventTrackingBackendProcess.FollowLobbyEvent(EventTrackingBackendProcess.InFolloLobbyType.GotoUnityRank, accountId);
                }
                break;
            }

            case "FollowLobby":
            {
                StyleBookCaptureImage.Instance.SetAllPartsDefault();
                int accountId = InParam["account_id"];
                if (accountId == AccountManager.Instance.GetUserAccountID())
                {
                    ThirdPartyBridge.SetNativeTabBarActivity(true);
                    UIPageInterface.OnMainLobby();
                }
                else
                {
                    UIPageInterface.OnFollowLobby(accountId);
                    EventTrackingBackendProcess.FollowLobbyEvent(EventTrackingBackendProcess.InFolloLobbyType.GotoUnityFollow, accountId);
                }
                break;
            }

            case "SeasonBook":
            {
                UIPageInterface.OnWebViewSeasonBook();
                break;
            }

            case "Mission":
            {
                UIPageInterface.OnWebViewMission();
                break;
            }

            case "Styling":
            {
                var pageinfo = PageManager.Instance.CurrOpenPageInfo();
                if (pageinfo.CurrPage == PageEnum.ActivityStyling)
                {
                    return;
                }
                int  partID  = InParam["partId"];
                bool isEquip = InParam["isEquip"];
                if (isEquip == true)
                {
                    AdaAvatar.Instance.EquipPartsItem(AdaAvatar.Instance.selectedCharacterID, partID);
                    UIPageInterface.OnStylingParts(true, partID);
                }
                else
                {
                    UIPageInterface.OnStylingParts(false, partID);
                }

                break;
            }

            case "ActivityStyling":
            {
                var pageinfo = PageManager.Instance.CurrOpenPageInfo();
                if (pageinfo.CurrPage == PageEnum.ActivityStyling)
                {
                    return;
                }
                int challengeId = InParam["challengeId"];
                int partID      = InParam["partId"];
                UIPageInterface.OnStylingActivityParts(challengeId, partID);
                break;
            }

            case "Challenge":
            {
                UIPageInterface.OnWebViewStyleChallenge();
                break;
            }

            case "CelebList":
            {
                UIPageInterface.OnCelebritySelect();
                break;
            }

            case "RoomChange":
            {
                UIPageInterface.OnRoomChange();
                break;
            }

            case "ActivityLookRoom":
            {
                ChallengeH5Data challengeH5Data = ChallengeH5Data_Parser.Parsing(InParam["challengeData"]);
                if (challengeH5Data == null)
                {
                    return;
                }
                string viewPage            = InParam["viewPage"];
                string webUrl              = InParam["webUrl"];
                int    webType             = InParam["webType"];
                ICharacterEquipParts equip = JsonUtility.FromJson <ICharacterEquipParts>(InParam["equip"]);
                UIPageInterface.OnActivityStylingChallenge(challengeH5Data, viewPage, equip, webUrl: webUrl, webType: webType);
                break;
            }

            case "ActivityLook":
            {
                ICharacterEquipParts equip = JsonUtility.FromJson <ICharacterEquipParts>(InParam["equip"]);
                var pageinfo = PageManager.Instance.CurrOpenPageInfo();
                if (pageinfo.CurrPage == PageEnum.ActivityStyling)
                {
                    var adaCharacter = AdaAvatar.Instance.GetCurrCharacter();
                    adaCharacter.EquipLook(equip);
                }
                else
                {
                    UIPageInterface.OnActivityStylingLook(equip);
                }
                break;
            }

            case "ChatRoomRunWay":
            {
                UIPageInterface.OnChatRoomRunWay();
                break;
            }

            case "ChallengeRoom":
            {
                ChallengeH5Data challengeH5Data = ChallengeH5Data_Parser.Parsing(InParam["challengeData"]);
                if (challengeH5Data == null)
                {
                    return;
                }
                AdaNetwork.GetProcess <ChallengeProcess>().backH5DataJson = InParam["challengeData"];
                UIPageInterface.OnStylingChallenge(challengeH5Data);
                break;
            }
            }
        }
Esempio n. 6
0
        public static void Handle(string InType, JSONNode InParam, JSONNode InThroughParam, string InExtra)
        {
            JSONNode backDataJson = null;

            switch (InType)
            {
            case "getRoomConfig":
            {
                var graphicOption      = SceneManager.Instance.GetComponent <graphicOptionCTRL>();
                int defaultPerformance = 2;
                if (null != graphicOption)
                {
                    switch (graphicOption.graphicOption)
                    {
                    case graphicOptionCTRL.TierSetting.High:
                        defaultPerformance = 2;
                        break;

                    case graphicOptionCTRL.TierSetting.Mid:
                        defaultPerformance = 1;
                        break;
                    }
                }

                backDataJson = new JSONObject
                {
                    ["result"]      = "succeed",
                    ["bgm"]         = AudioManager.Instance.MusicVolume,
                    ["effect"]      = AudioManager.Instance.EffectVolume,
                    ["performance"] =
                        LocalDataController.GetLocalDataValue_Int(LocalDataController.GraphicOption,
                                                                  defaultPerformance)
                };
            }
            break;

            case "setSoundBgm":
                AudioManager.Instance.MusicVolume = InParam["value"].AsInt;
                backDataJson = new JSONObject
                {
                    ["result"] = "succeed"
                };
                break;

            case "setSoundEffect":
                AudioManager.Instance.EffectVolume = InParam["value"].AsInt;
                backDataJson = new JSONObject
                {
                    ["result"] = "succeed"
                };
                break;

            case "setSoundBGMOn":
                AudioManager.Instance.MusicSwitch = true;
                backDataJson = new JSONObject
                {
                    ["result"] = "succeed"
                };
                break;

            case "setSoundBGMOff":
                AudioManager.Instance.MusicSwitch = false;
                backDataJson = new JSONObject
                {
                    ["result"] = "succeed"
                };
                break;

            case "setSoundEffectOn":
                AudioManager.Instance.EffectSwitch = true;
                backDataJson = new JSONObject
                {
                    ["result"] = "succeed"
                };
                break;

            case "setSoundEffectOff":
                AudioManager.Instance.EffectSwitch = false;
                backDataJson = new JSONObject
                {
                    ["result"] = "succeed"
                };
                break;

            case "setGoldValue":
                int gold = AccountManager.Instance.SetPropertyGold(InParam["value"].AsInt);
                AdaNetwork.GetProcess <MissionProcess>().missionManager.UpdateMission_GOLD(gold);
                backDataJson = new JSONObject
                {
                    ["result"] = "succeed"
                };
                break;

            case "setCashValue":
                int cash = AccountManager.Instance.SetPropertyCash(InParam["value"].AsInt);
                AdaNetwork.GetProcess <MissionProcess>().missionManager.UpdateMission_CASH(cash);
                backDataJson = new JSONObject
                {
                    ["result"] = "succeed"
                };
                break;

            case "setGraphicPerf":
            {
                int quality = InParam["value"].AsInt;

                var graphicOption = SceneManager.Instance.GetComponent <graphicOptionCTRL>();

                if (graphicOption != null)
                {
                    switch (quality)
                    {
                    case 1:
                        graphicOption.SetGraphicTierMid();
                        LocalDataController.SetLocalDataValue_Int(LocalDataController.GraphicOption, quality);
                        break;

                    case 2:
                        graphicOption.SetGraphicTierHigh();
                        LocalDataController.SetLocalDataValue_Int(LocalDataController.GraphicOption, quality);
                        break;

                    default:
                        backDataJson = new JSONObject
                        {
                            ["result"] = "failed",
                            ["value"]  = 2,
                            ["msg"]    = "Out of range, Set graphic level = 2"
                        };
                        graphicOption.SetGraphicTierHigh();
                        LocalDataController.SetLocalDataValue_Int(LocalDataController.GraphicOption, 2);
                        break;
                    }
                }
                else
                {
                    backDataJson = new JSONObject
                    {
                        ["result"] = "failed",
                        ["value"]  = 2,
                        ["msg"]    = "Not found graphic setting."
                    };
                }


                if (null == backDataJson)
                {
                    backDataJson = new JSONObject
                    {
                        ["result"] = "succeed"
                    };
                }
            }
            break;

            case "gotoUnityPage":
                ThirdPartyGotoUnity.GotoUnity(InParam);
                break;

            case "mission":
                if (InParam != null)
                {
                    string        playType     = InParam["play_type"].Value;
                    string        categoryType = InParam["category_type"].Value;
                    JSONArray     missionTag   = InParam["mission_tag"].AsArray;
                    List <string> list         = new List <string>();
                    for (int i = 0; i < missionTag.Count; i++)
                    {
                        list.Add(missionTag[i]);
                    }
                    MissionProcess.NativeSendMission(playType, categoryType, list.ToArray());
                }
                break;

            case "missionCheck":
                var        aCharacter     = AdaAvatar.Instance.GetCurrCharacter();
                var        partsDatas     = aCharacter.GetCurrEquipAllSlotID();
                int        stylebookId    = InParam["stylebookId"].AsInt;
                bool       customBg       = InParam["customBg"].AsBool;
                JSONArray  stampListArray = InParam["stampList"].AsArray;
                List <int> stampList      = new List <int>();
                for (int i = 0; i < stampListArray.Count; i++)
                {
                    stampList.Add(stampListArray[i]);
                }

                AdaNetwork.GetProcess <MissionProcess>().StyleBookMissionCheck(stylebookId, partsDatas, stampList.ToArray(), customBg);
                break;

            case "attendMissionCheck":
                var data = DataTableManager.Instance.dailyAttendanceData.GetDailyData();
                if (data != null)
                {
                    AdaNetwork.GetProcess <MissionProcess>().missionManager.UpdateMission(MissionPlay_type.PARTICIPATE, MissionCategory_type.DAILYATTENDANCE, data.mission_tag);
                }
                break;

            case "playEffect":
                AudioManager.Instance.PlayEffect((AudioKey)InParam["index"].AsInt);
                break;

            case "playMusic":
                AudioManager.Instance.PlayMusic((AudioKey)InParam["index"].AsInt);
                break;

            case "mailReceive":
            {
                Log.Info("开始处理邮件", ColorName.Red);
                ResponseMailRecive value = JsonUtility.FromJson <ResponseMailRecive>(InParam.Value);
                MailH5MissionProcess.OnReceiveMailReceive(value);
                break;
            }

            case "mialReceiveAll":
            {
                Log.Info("开始处理全部邮件", ColorName.Red);
                ResponseMailReciveAll value = JsonUtility.FromJson <ResponseMailReciveAll>(InParam.Value);
                MailH5MissionProcess.OnReceiveMailReceiveAll(value);
                break;
            }

            case "ChallengeResult":
            {
                backDataJson = AdaNetwork.GetProcess <ChallengeProcess>().challengeResult;
                break;
            }

            default:
                Log.Error($"Not found third party H5 dispatch handle named {InType}.");
                backDataJson = new JSONObject()
                {
                    ["result"] = "failed",
                    ["msg"]    = $"Not found third party H5 dispatch handle named {InType}."
                };
                break;
            }

            Log.Info(
                $"[ThirdPartyH5Dispatch] -- Type = {InType}\nParam = {InParam}\nThroughParam = {InThroughParam}\nBackParam = {backDataJson}");

            ThirdPartyBridge.ToNative(CommandType.H5AndUnity,
                                      MakeBackJsonNode(InType, backDataJson, InThroughParam));

            ToNativeDone(InType);
        }